## ritikashah017

BAN USER- 0of 0 votes

AnswersToday is school picture day and everybody,

- ritikashah017 in United States

including the teacher, has lined up in a single line for the class picture.

Design an O(n log n) Java code that computes the minimum number of swaps necessary to be in order| Report Duplicate | Flag | PURGE

Amazon Intern Java - 0of 0 votes

AnswersGive java code that takes an instance of the stable marriage problem as input and decides if there is { exactly one} stable matching for this instance (that is, the program outputs either ``unique stable matching'', or ``more than one stable matching'').

- ritikashah017 in United States

input:

3

0 1 2

1 0 2

0 1 2

1 0 2

0 1 2

0 1 2

Output:

more than one stable matching| Report Duplicate | Flag | PURGE

Intuit Software Engineer Intern Algorithm

How will you justify the complexity is O(n^2 log n)?

- ritikashah017 February 12, 2016How will you justify the complexity is O(n^2 log n)?

- ritikashah017 February 12, 2016How will you justify the complexity is O(n^2 log n)?

- ritikashah017 February 12, 2016Input is this format:

8

-2 1

0 2

0 -1

1 -2

2 0

2 1

1 2

2 2

Output is 3

May be this will help.

The Input specification was given as follows:

Input specification: the first line contains n, the total number of people (students plus teacher). You are guaranteed that n will be an odd integer greater than or equal to 3. Each subsequent line contains two numbers, separated by a space. The first of these numbers is the age of a person. It will either be a 7, an 8, or a third, unique value that corresponds to the age of the teacher. You are guaranteed that (n-1)/2 of the ages will be 7, (n-1)/2 of the ages will be 8, and 1 age will have a different value corresponding to the teacher.

The second number on each line is a floating point value representing the height of that person (in centimeters, although it really doesn't matter).

Input:

7

8 127.6

7 128.4

7 107.8

8 116.5

7 103.9

44 166.4

8 134.3

Outpu:

11

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Open Chat in New Window

What if you wanted( n^2 log n)

- ritikashah017 February 13, 2016