kkaushi
BAN USER
Are you sure it's O(n).
for(i = 0; i < len; i++) {
int new_idx = get_index(i, N);
while(new_idx < i) {
new_idx = get_index(new_idx, N);
}
printf("i: %d; new_idx: %d\n", i, new_idx);
swap(&s[i], &s[new_idx]);
}
What about the while loop inside for. Does it always takes constant time?
I think it's O(n^2) as inner while loop is dependent on n or it's O(n)
a[-1] points to i because when the line
int a[3],i;
is encountered during execution, space is allocated in stack equal to space of 3 ints (for array a) + space for 1 integer (ie i). Let the adress of a[0] be 0x00000008 (for simplification and assuming 32 bit int size). Then a[1] would be at address 0x0000000c and a[2] would have address 0x000000010. The address of i would be 4 bytes before a[0]'s address in stack ie 0x00000006 because the space is allocated in Right To Left order ie i first, followed by a[3].
- kkaushi August 03, 2014
RepAriaScott, abc at 247quickbookshelp
I am a qualified medical representative who has been in the industry for many years and has proven sales experience ...
Repmendezleah216, Analyst at Bosch
Hello,everybody,I'm Leah Mendez.I want to make some friends here.I’m a woman with ambition and ...
Repjoyceeallard, Associate at Adap.tv
Hi, i am working as a training manager as a business professional who assesses the growth and development needs of ...
Repkalerkant98, abc at ADP
I am DennisRue, seeking an entry level position where my strong work ethics and ability to learn quickly will contribute ...
RepJamesFain, Area Sales Manager at ABC TECH SUPPORT
Phil has nearly 30 years of experience as a fisheries research scientist and directs the CFS Northwest science team. He ...
RepLaylaLee, abc at AMD
Creative and dedicated photo editor with experience in photojournalism and marketing material development. I like to explore Best tantrik in ...
Repfanniepaisley, Computer Scientist at ABC TECH SUPPORT
Fannie Parsley, and I'm working as a Cartographer. And nowadays I am doing a new experiment on best tantrik ...
RepNatalieLutz, Applications Developer at Absolute Softech Ltd
Pitch trending story topics and continually look for ways to push breaking and/or viral stories forward with new angles ...
Replevijhoyt, Android Engineer at A9
Hello, I am working as a machine operator and we are working in manufacturing units and operate equipment to create ...
Repnasliebaker, Solutions Engineer at Edinprotechnologies
Je suis Naslie , un chercheur interdisciplinaire et collaboratif axé sur l'amélioration de la santé humaine et le mentorat de ...
Repjunehudson, Associate at Advisory Board Company
I am passionate about fashion and love to explore black magic to take revenge.Being a fashion designer involves more ...
RepSharonSwann, AT&T Customer service email at A9
Bilingual, self-motivated Air Hostess with a proven record of providing excellent customer service and exceeding all corporate and personal expectations ...
Repbarrietrosado, abc at ABC TECH SUPPORT
Hi, I am Barrie, from Ualapue USA. I believe that every challenge has a solution - and I take great satisfaction ...
Repnatetouche, Applications Developer at Alcatel Lucent
My name is NateTouche . I currently live in Seattle . One desire that has always been a constant since As a ...
RepMariaBJiles, Accountant at A9
I am working as a team leader in a development software company. I am creative in learning how to crochet ...
Repdevlinadevid, CAD Designer at FeatureCAM
Experienced CAD drafter seeking an advanced architectural position. Interested in culinary arts and currently in a course for making sushi ...
RepAadavThomas, abc at A9
I am a well skilled and innovative Industrial Designer who focuses on taking products, noting product ideas and making them ...
Repthubmorfin, Android Engineer at ABC TECH SUPPORT
I am currently working as a safety-focused Service Technician from Red Bank. I execute routine maintenance work while advising clients ...
RepMiaMiller, abc at A9
Experienced software engineer with a passion for developing innovative programs that expedite the efficiency and effectiveness of organizational success. Well-versed ...
Rephoychrista, Blockchain Developer at ASU
Worked with Clients to guide them through the event details about copier leasing companies and served as their personal coordinator ...
Repearleneefranks, Accountant at 247quickbookshelp
I am working as an Information clerk and I love my job. I also love to read new Articles related ...
Repjj2234971, Applications Developer at ABC TECH SUPPORT
My role for teaching students in a particular subject area. I specialize in a variety of subjects and fields. such ...
Repjudithasmith175, Accountant at Akamai
Hey, my name is Terry and I completed all my study from California. And Nowadays I am working as a ...
That won't work as you need to interchange left/right child of all nodes in subtree of root->left and root->right.
- kkaushi August 04, 2014