Jump to content

Code Cleanliness Ante Enti


Recommended Posts

Posted

I didnot work in python... but ..the thing is use any language....
but print powerset ade problem try cheyi

Ok
  • Replies 64
  • Created
  • Last Reply

Top Posters In This Topic

  • GunturGongura

    12

  • chaikumar

    11

  • uncertainity

    10

  • puli_keka

    9

Posted

ok ya …..kani python lo list untundi..like[1,2,3,5]

subsets are[1],[2]….[1,2,3,5]

e {1} notation ni emantaru python lo?

these flower brackets basically are dictionaries with key and value

Posted

ok ya …..kani python lo list untundi..like[1,2,3,5]

subsets are[1],[2]….[1,2,3,5]

e {1} notation ni emantaru python lo?

these flower brackets basically are dictionaries with key and value

Posted

just checking... Evening ayindi...

It's still 1:40 no just came back from lunch -1xsWM.gif
Posted

It's still 1:40 no just came back from lunch -1xsWM.gif

antey... TS EST emo kada.. Akkada evening ayindi kada ani
Posted

ok ya …..kani python lo list untundi..like[1,2,3,5]

subsets are[1],[2]….[1,2,3,5]

e {1} notation ni emantaru python lo?

these flower brackets basically are dictionaries with key and value


Entidi
Posted

Entidi


I was driving and accidentally hit reply button.

He just gave an example for output, showing with curly braces.

You can use lists or sets in python to store these subsets and then print them.
Posted

Output: 

 
1,
2,
3,
5,
1, 2,
1, 3,
1, 5,
2, 2,
2, 3,
2, 5,
3, 2,
3, 3,
3, 5,
1, 2, 3,
1, 2, 5,
1, 3, 3,
1, 3, 5,
2, 2, 3,
2, 2, 5,
2, 3, 3,
2, 3, 5,
 
problem enti ante 1,3, 3 kuda printing...aa print statement lo distinct unte ne print cheyi anali..like print[j]< print[j+1[
public void SubSetsMain()
        {
            int[] arr = new int[4]{1,2,3,5};
            int[] printarr = new int[arr.Length];
            int index =0;
            for (int i = 0; i < arr.Length; i++)
            {
                FindSubSets(arr, 0, arr.Length, i, printarr, index);
            }
            Console.ReadLine();
        }

        public void FindSubSets(int[] arr, int start, int end, int numberofelements, int[] printarr, int index)
        {
            if (numberofelements == 0)
            {
                for (int j = 0; j < index; j++)
                    Console.Write(printarr[j] + ", ");
                Console.WriteLine();
                return;
            }
            for(int i = start; i<= end - numberofelements; i++)
            {
                printarr[index] = arr[i];
                FindSubSets(arr, start + 1, end, numberofelements-1, printarr, index + 1);
            }
        }
 
 

given input : {1,2,3,5}

 

subsets are print output:

{1}{2}{3}{5}

{1,2}{1,3}{1,5}{2,3}{2,5}{2,5}{3,5}

{1,2,3}{1,2,5}{1,3,5}{2,3,5}

{1,2,3,5}

================================================

 

sum vishayaniki vosthe .. prathi dhani sum print cheyal anthe.....

 

Posted

Uncertainity


Kasta interview guide chey for ms students for entry level n interns

Em adgutaru

×
×
  • Create New...