Implement an algorithm to simulate car re-organizing, Data Structure & Algorithms

Design  and implement  an algorithm  to simulate car  re-organizing of the train at the railway switching junction. You can only use stacks as the data structure to represent the train and the cars in each transit rail.

Task 1: For any given  input of car order is  c1,c2,...,cn  and  a number  k  of transit rails (k≥2), design and implement an algorithm to simulate the car ordering procedure by using stack operations only so that the output of the car order is 1,2,...,n.

Task 2:  Analyse efficiency of your algorithm using Big-O notation by counting the number of stack operations used in your algorithm ( worst case analysis).

Task 3: Assume that k=n/2+1. Improve your algorithm so that its complexity is in O(n).  

Task 4: Discuss the efficiency of your algorithm in relation to k if k can be any number such that k≥2.

Posted Date: 3/29/2013 5:28:09 AM | Location : United States







Related Discussions:- Implement an algorithm to simulate car re-organizing, Assignment Help, Ask Question on Implement an algorithm to simulate car re-organizing, Get Answer, Expert's Help, Implement an algorithm to simulate car re-organizing Discussions

Write discussion on Implement an algorithm to simulate car re-organizing
Your posts are moderated
Related Questions
Taking a suitable example explains how a general tree can be shown as a Binary Tree. Conversion of general trees to binary trees: A general tree can be changed into an equiv

1)    The set of the algorithms whose order is O (1) would run in the identical time.  True/False 2)    Determine the complexity of the following program into big O notation:

Develop a program that accepts the car registration( hint: LEA 43242010)

Q. Give the algorithm to build a binary tree where the yields of preorder and post order traversal are given to us.

what''s queue ?

The  total  of  time  needed  by  an algorithm to run to its completion is termed as time complexity. The asymptotic running time of an algorithm is given in terms of functions. Th

Q. Prove the hypothesis that "A tree having 'm' nodes has exactly (m-1) branches".      Ans: A tree having m number of nodes has exactly (m-1) branches Proof: A root

Declaring a two dimensional array   A two dimensional array is declared same to the way we declare a one-dimensional array except that we state the number of elements in both di

The smallest element of an array's index is called its Lower bound.