Assignment Task :

Part 1 

Note: Answer to each question should be accompanied with the correctness argument and analysis for time complexity 

1. Given an array a[0, , n-1] of n nonzero integers ordered in the ascending order, develop an algorithm to remove all duplicates by replacing a duplicate with 0 value; the algorithm should also return the effective size of the output array. An instance of an ordered array before duplicate removal is: |2|2|4|8|8|23|37|37|42|. After the duplicate removal we have the following array: |2|4|8|23|37|42|0|0|0 with an effective size of this output array to be 6. 

2. Given a randomly ordered array of n elements partition the elements into two subsets such that elements less than x are in one subset and elements greater than x are in separate subset. For instance, |28|26|25|11|16|12|24|29|6|10| and x = 17 lead to the array |10|6|12|11|16|25|24|29|26|28|. We provide here a high level algorithmic description of the problem. 

• Establish the array a[0, ..., n − 1] and the partitioning value x. 

• Move the partitions towards each other until the wrongly placed elements are encountered. 

Allow for special cases such as x being outside the range of array values. 

• While the two partitions have not crossed over 

  •  exchange the wrongly partitioned pair and extend both partitions inward by one element
  • extend left partition while elements less tha or equal to x
  • extend the right partition while elements are greater than x
  • Return the partitioning index p in the partitioned array.

 

This Engineering Assignment has been solved by our Engineering Experts at UniLearnO. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.

Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.

Eureka! You've stumped our genius minds (for now)! This exciting new question has our experts buzzing with curiosity. We can't wait to craft a fresh solution just for you!

  • Uploaded By : Grace
  • Posted on : July 07th, 2019

Whatsapp Tap to ChatGet instant assistance