0

This program is for a car rental agency. Your program will have to compute the
total cost of a rental. This agency has two types of cars, and the rates per day
are as follows: All cars come with a basic insurance that covers damage to third
Driver above 25
years of age
Driver 25 years
old or younger.
Compact car $60 $80
Mid-size car $75 $100
Table 4: Price list for problem A.3
parties. Comprehensive insurance cover costs $30 for compact cars and $40 for
mid-size cars.

5
Contributors
6
Replies
35
Views
3 Years
Discussion Span
Last Post by rubberman
0

We all would be happy to help, once you've shown some work on your own part. We are willing to give advice, answer specific questions, and even show how to find and fix bugs. But we will not do the work for you.

0

Can Anyone help me understanding the bubble sort data structure? and LIFO.

Edited by Morganstevens: spelling

1

First off, do not hijack an existing thread with an unrlated question. I know that the OP gave this thread an unfortunately generic title, but that isn't an invitation to discuss all aspects of C++ in it.

Second, the question is rather generic itself, and an easy answer is difficult to give, especailly since the fist question is invalid - Bubble Sort is an algorithm (that is to say, a description of how to perform a task), not a data structure (a grouping of data values in a particular manner). The main idea - one simple enough that most people find it themselves on their first try at sorting - is to repeatedly pass over the array in order, and compare each value to the one following it; if the second value is lower, you then swap the two values, and proceed. The result is that the higher values 'bubble up' to the top over successive passes.

There are many pages on the Web which explain Bubble Sort, and sorting in general, and a trivial search should find several such as this one.

A stack or LIFO queue is a data structure, but one which is used in a particular manner - it is ordered in such a way that the last item placed in it is the first one to be removed. The usual solution to making a stack is to have an array and an index indicating where the 'top' of the stack is, and you would simply increment or decrement the index to add or remove items. Again, a simple search will uncover a large number of tutorials on the subject.

0

@Shol-R-Lea
Well put!

@Morganstevens
Read Donald Knuth's seminal volume 3 of the "Art of Computer Programming, Sorting and Searching". I am considered an "expert" on database systems. Knuth volume 3 is where I learned the basics of the subject - that and the works of Codd and Date.

Edited by rubberman

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.