2018-01-30

Jan 31 In-Class Exercise Thread.

Hey Everyone,
Post your solutions to the Jan. 31 In-Class Exercise to this thread.
Best, Chris
Hey Everyone, Post your solutions to the Jan. 31 In-Class Exercise to this thread. Best, Chris

-- Jan 31 In-Class Exercise Thread
Randomize-In-Place: `O(n)`. n swaps are performed and we only move through the loop once.
Permute-By-Sorting: `O(nlogn)`. Generating priorities is `O(n)`, sorting by those priorities is `O(nlogn)` => `O(nlogn)` dominates.
-Dean Johnson
(Edited: 2018-01-31)
Randomize-In-Place: @BT@O(n)@BT@. n swaps are performed and we only move through the loop once. Permute-By-Sorting: @BT@O(nlogn)@BT@. Generating priorities is @BT@O(n)@BT@, sorting by those priorities is @BT@O(nlogn)@BT@ => @BT@O(nlogn)@BT@ dominates. -Dean Johnson

-- Jan 31 In-Class Exercise Thread
kunal deshmukh
complexity for :
  • Randomize in place : `O(n)`
  • permute by sorting : `O(n log(n))`
(Edited: 2018-01-31)
kunal deshmukh complexity for : * Randomize in place : @BT@O(n)@BT@ * permute by sorting : @BT@O(n log(n))@BT@

-- Jan 31 In-Class Exercise Thread
Revanth Akella
  • Randomize-in-place: `O(n)`
  • Permute-by-sorting: `O(nlog(n))`
(Edited: 2018-01-31)
Revanth Akella * Randomize-in-place: '''@BT@O(n)@BT@''' * Permute-by-sorting: '''@BT@O(nlog(n))@BT@'''

-- Jan 31 In-Class Exercise Thread
Randomize-in-place has a runtime of O(n) - as we iterate through each element and swap
Permute-By-Sorting has runtime of O(nlogn) - as we sort and the best sorting runtime time is O(nlogn)
(Edited: 2018-01-31)
'''Randomize-in-place''' has a runtime of '''O(n)''' - as we iterate through each element and swap '''Permute-By-Sorting''' has runtime of '''O(nlogn)''' - as we sort and the best sorting runtime time is O(nlogn)

-- Jan 31 In-Class Exercise Thread
Randomize-In-Place: `O(n)` : reason - We need to iterate through entire array of size n
Permute-By-Sorting: `O(n logn)` : reason - Best possible sorting is `O(n logn)`
By: Pratikkumar Prajapati
(Edited: 2018-01-31)
Randomize-In-Place: @BT@O(n)@BT@ : reason - We need to iterate through entire array of size n Permute-By-Sorting: @BT@O(n logn)@BT@ : reason - Best possible sorting is @BT@O(n logn)@BT@ By: Pratikkumar Prajapati

-- Jan 31 In-Class Exercise Thread
Randomize-in-place: O(n) Permute-by-sorting: O(nlog(n)) (sorting step requires O(nlogn))
Randomize-in-place: O(n) Permute-by-sorting: O(nlog(n)) (sorting step requires O(nlogn))

-- Jan 31 In-Class Exercise Thread
Name: Vincent Stowbunenko
Randomize-in-Place: O(n)
Permute-By-Sorting: O(n log(n))
(Edited: 2018-01-31)
Name: Vincent Stowbunenko Randomize-in-Place: O(n) Permute-By-Sorting: O(n log(n))

-- Jan 31 In-Class Exercise Thread
Randomised-In-Place : O(n)
As we visit every element of array.
Permute-By-Sorting : O(n.log(n))
Best sort complexity using Heap or Merge sort
- Mayuri Wadkar
(Edited: 2018-01-31)
Randomised-In-Place : '''''O(n)''''' As we visit every element of array. Permute-By-Sorting : '''''O(n.log(n))''''' Best sort complexity using Heap or Merge sort - Mayuri Wadkar

-- Jan 31 In-Class Exercise Thread
Randomize in Place has `O(n)` because it iterates over the list and swaps. Whereas, permute by sorting is `O(n log(n))` because it has to sort the list as per the priorities.
Randomize in Place has @BT@O(n)@BT@ because it iterates over the list and swaps. Whereas, permute by sorting is @BT@O(n log(n))@BT@ because it has to sort the list as per the priorities.
[ Next ]
X