Skip to main content
Code Review

Return to Question

Commonmark migration
Source Link

Given a sorted list with an unsorted number e in the rightmost cell, can you write some simple code to insert into the array so that it remains sorted?

Print the array every time a value is shifted in the array until the array is fully sorted. The goal of this challenge is to follow the correct order of insertion sort.

Guideline: You can copy the value of to a variable and consider its cell "empty". Since this leaves an extra cell empty on the right, you can shift everything over until can be inserted. This will create a duplicate of each value, but when you reach the right spot, you can replace it with .

Given a sorted list with an unsorted number e in the rightmost cell, can you write some simple code to insert into the array so that it remains sorted?

Print the array every time a value is shifted in the array until the array is fully sorted. The goal of this challenge is to follow the correct order of insertion sort.

Guideline: You can copy the value of to a variable and consider its cell "empty". Since this leaves an extra cell empty on the right, you can shift everything over until can be inserted. This will create a duplicate of each value, but when you reach the right spot, you can replace it with .

Given a sorted list with an unsorted number e in the rightmost cell, can you write some simple code to insert into the array so that it remains sorted?

Print the array every time a value is shifted in the array until the array is fully sorted. The goal of this challenge is to follow the correct order of insertion sort.

Guideline: You can copy the value of to a variable and consider its cell "empty". Since this leaves an extra cell empty on the right, you can shift everything over until can be inserted. This will create a duplicate of each value, but when you reach the right spot, you can replace it with .

replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

During an interview, I was given this Hackerrank question to solve within 15 minutes but at that time I was interested in solving this without performance in my mind. I know a similar question has been asked Hackerrank Insertion Sort - Java Hackerrank Insertion Sort - Java and probably a lot in CR.

During an interview, I was given this Hackerrank question to solve within 15 minutes but at that time I was interested in solving this without performance in my mind. I know a similar question has been asked Hackerrank Insertion Sort - Java and probably a lot in CR.

During an interview, I was given this Hackerrank question to solve within 15 minutes but at that time I was interested in solving this without performance in my mind. I know a similar question has been asked Hackerrank Insertion Sort - Java and probably a lot in CR.

deleted 9 characters in body; edited title
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

Hackerrank Insertion Sort Algorithm 1 - (Creatingcreating duplicates to show shifting)

  • SizeSize- the size of the array
  • ArrArr- the unsorted array of integers

Constraints

1 ≤ Size ≤ 1000

-10000 ≤ e ≤ 1000, e E Arr

  • 1 ≤ Size ≤ 1000
  • -10000 ≤ e ≤ 1000, e E Arr

Here is my code


Any thoughts on Performanceperformance, Stylestyle or shortened Codecode length?

Hackerrank Insertion Sort Algorithm 1 - (Creating duplicates to show shifting)

  • Size- the size of the array
  • Arr- the unsorted array of integers

Constraints

1 ≤ Size ≤ 1000

-10000 ≤ e ≤ 1000, e E Arr

Here is my code

Any thoughts on Performance, Style or shortened Code length?

Hackerrank Insertion Sort Algorithm 1 (creating duplicates to show shifting)

  • Size- the size of the array
  • Arr- the unsorted array of integers

Constraints

  • 1 ≤ Size ≤ 1000
  • -10000 ≤ e ≤ 1000, e E Arr

Any thoughts on performance, style or shortened code length?

fixed copy/paste indentation
Source Link
t3chb0t
  • 44.6k
  • 9
  • 84
  • 190
Loading
Source Link
Tolani
  • 2.5k
  • 7
  • 31
  • 49
Loading
lang-cs

AltStyle によって変換されたページ (->オリジナル) /