Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Java && C#)/ Ch 10 / Q 1 - Sorted Merge / Input demo array is not sorted #191

Open
moudrick opened this issue Jan 30, 2020 · 0 comments
Open

Comments

@moudrick
Copy link

moudrick commented Jan 30, 2020

There is a flaw in demo example for Question 1 Sorted Merge of Chapter 10 Sorting and Searching. The demo array that is supposed to be sorted as a pre-condition is not actually sorted. This leads to the fact that the demo result is not sorted as well.
See CtCI-6th-Edition/Java/Ch 10. Sorting and Searching/Q10_01_Sorted_Merge/Question.java:

Line 34: int[] b = {1, 4, 7, 6, 7, 7};

Same goes to C# Demo.
See Issue #17 there - Ch 10 / Q 1 - Sorted Merge / Input demo array is not sorted.
See CtCI-6th-Edition-CSharp/Ch 10. Sorting and Searching/Q10_01_Sorted_Merge.cs

Line 42: int[] b = new int[] { 1, 4, 7, 6, 7, 7 };

At the same time, in PHP solutions, this example is modified to be sorted and used in demo unit tests.
See CtCI-6th-Edition-php/test/chapter10/question10.01/SortedMergeTest.php

Line 48: $b = [ 1, 4, 6, 7, 7, 7 ];

If this unsorted sample is not introduced intentionally to check if the reader is attentive, this should be fixed, I believe. Preparing Pull Requests for this:

@moudrick moudrick changed the title (Java && C#)/ Ch 10 / Q 1 / Input demo array is not sorted (Java && C#)/ Ch 10 / Q 1 - Sorted Merge / Input demo array is not sorted Jan 30, 2020
moudrick added a commit to moudrick/CtCI-6th-Edition that referenced this issue Jan 30, 2020
 careercup#191 - ( Ch 10 / Q 1 - Sorted Merge / Input demo array is not sorted)[careercup#191]
moudrick added a commit to moudrick/CtCI-6th-Edition-CSharp that referenced this issue Jan 30, 2020
Issue (careercup#17 - Ch 10 / Q 1 - Sorted Merge / Input demo array is not sorted)[careercup#17]
Main issue in CtCI-6th-Edition - (#191 - (Java && C#)/ Ch 10 / Q 1 - Sorted Merge / Input demo array is not sorted)[careercup/CtCI-6th-Edition#191]
moudrick added a commit to moudrick/CtCI-6th-Edition-FSharp that referenced this issue Jan 30, 2020
moudrick added a commit to moudrick/CtCI-6th-Edition-FSharp that referenced this issue Jan 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant