Tuesday 17 September 2013

Beginners Programming Concepts and Analysis Using Csharp (C#)

I am going to explain a small piece of Problem regarding any Programming language, from me i am using C sharp commonly known As C# and using a console based output! C sharp is pretty interesting and easy to use! Code will be provided soon! If any suggestions and comment you can please tell me i much appreciate it!
Note: This is the problem for beginners we will use iterative method not Recursive! and will find out the complexity! 

The Problem: In merge sort we need to divide the input integer array into equal parts recursively till we
reach to the base case (only one item left in splitted arrays). You need to implement the same behavior
but without recursive calls. Your program should get size of array as an input from the user (assume
the array size will always be power of 2). Then the program should ll the array with random values and
split the array till you reach the base case. There is no language and data type restrictions. Your program
should print an output as follows:
Array: 2,3,4,5,6,0,3,1
Left: 2,3,4,5
Right: 6,0,3,1
------------------
Array: 2,3,4,5
Left: 2,3
Right: 4,5
------------------
Array: 6,0,3,1
Left: 6,0
Right: 3,1
------------------
Array: 2, 3
Left: 2
Right: 4
------------------
Array: 4,5
Left: 4
Right: 5
------------------
Array: 6,0
Left: 6
Right: 0
------------------
Array: 3,1
Left: 3
Right: 1
------------------

No comments:

Post a Comment

Please add sensible comments! Please don't spam otherwise Comment will not be published. Share your Thoughts!