473,386 Members | 1,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

I need HELP in that program!

memoman
Can any body help me in that program ???

mail me if anybody could reach any -helpfull- thing

Write a C++ program that namely insert, delete, and search in a fixed record length file (containing a person’s name and age). Associated with the record file will be a file that stores a binary search tree index that allows for a quick search through the index. The required operations will be provided using an input file that will be specified in the command prompt. The file will have lines with the following format:

Required_Operation (tab) Name (tab) [Age]

where Required_Operation has a value of 1, 2, or 3 which corresponds to insert, delete, and search respectively.

The Name is a string with a maximum length of 20 characters.
The Age is an optional argument that is supplied only when an insert operation is required.

If the Required_Operation is an insertion or a deletion, the word “SUCSESS” (in all capital letters) is printed to STANDARD ERR.
If the Required_Operation is a search, the Age corresponding to the Name is printed to STANDARD OUT. If the search operation fails, the word “FAILED” (in all capital letters) is printed to STANDARD OUT.

The resultant record file has to be created using the mmap function and has to be able to accommodate up to exactly 32,768 records.
Associated with the record file is a bitmap file that is exactly 32,768 bits long that indicates which records are used or free. In a bitmap file, each bit corresponds to a record in the record file (bit 10 corresponds to record 10). If the bit is set to 1, then the corresponding record is used, and if the bit is 0, then the corresponding record is empty.

When inserting, use a first-fit strategy.

When deleting a record in the record file, simply set the corresponding bit in the bitmap file to 0.

Associated with the record file is a binary search tree that includes pointers to the locations in the record file corresponding to each Name. Since using the Name field would cause the index to be large and consequently inefficient, the value stored in each node of the binary tree is the Hash value of the Name (as mentioned earlier, using the SDBM Hash function is desirable).
Again use the mmap function to store the binary tree. Each node in the binary tree will include the value in the node (unsigned int), 2 pointers to the left and right children, and a pointer to the location of the record in the record file.
Like the record file, associated with binary tree file is a bitmap file that indicates which node positions are used or free. In a bitmap file,each bit corresponds to a node location in the binary tree file (bit 10 corresponds to node location 10). If the bit is set to 1, then the corresponding node location is used, and if the bit is 0, then the corresponding node location is empty. When inserting, use a first-fit strategy. When deleting a node, simply set the corresponding bit in the bitmap file to 0 and properly adjust the tree and the associated pointers.


Thanks in advance...
Attached Files
File Type: txt Program.txt (2.9 KB, 399 views)
Mar 24 '07 #1
4 1888
Please, I need HELP as fast as possible.

I've a little knowledge about C++, specially when dealing with Linus platforms like cygwin, you know mmap and these stuff.

Thanks in advance
Mar 24 '07 #2
sicarie
4,677 Expert Mod 4TB
As per our Posting Guidelines (available in the FAQ), we can't do your program for you, you need to ask a specific question about what you are having difficulty with, and we'll try to point you in the right direction, or show you proper syntax.

SO what have you tried on this? What error messages are you getting?
Mar 24 '07 #3
As per our Posting Guidelines (available in the FAQ), we can't do your program for you, you need to ask a specific question about what you are having difficulty with, and we'll try to point you in the right direction, or show you proper syntax.

SO what have you tried on this? What error messages are you getting?

Ah I see, thanks for declaration.

But my big problem that I dunno how to start, and how to organize all this requirments in one program.
Mar 24 '07 #4
sicarie
4,677 Expert Mod 4TB
Ah I see, thanks for declaration.

But my big problem that I dunno how to start, and how to organize all this requirments in one program.
Break them down into different programs. Do you know how the binary search tree algorithm works?

As I see it, you have a few main things to do - you have to create this index, from an input file stream, parse the line by tabs, and organize that index by struct/class or whatever.

From there, you can fill in the details as needed, but the trick is to get that overview - however works best for you. That's also part of the reason people diagram in UML, some people use the top-down method, and I (as you can see), make an outline. Class assignments go well with the outline method - you can put the big points down, and then fill in specific requirements for each main point. With the complexity of having he data, the index, and the bitmap, I would recommend UML - it's good for modeling the relationships between objects.
Mar 25 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Spamtrap | last post by:
I only do occasional Perl programming and most things I write are short processes. I have something I'm working on that is scanning a text file with about 15 million lines and trying to extract...
2
by: aj902 | last post by:
Hello , I am trying to create a program where all detail, http://www.albany.edu/~csi333/projects.htm
13
by: vgame64 | last post by:
Hi, I have been struggling with writing a program for a few hours. The requirements are that: """You will be writing a program which will determine whether a date is valid in terms of days in that...
4
by: robinsand | last post by:
My apologies to those of you who are more advanced Visual C++ .NET programmers, but I am working on a project for an MBA course that is condensed into an eight-week schedule, and I need help...
4
by: naknak4 | last post by:
Introduction This assignment requires you to develop solutions to the given problem using several different approaches (which actually involves using three different STL containers). You will...
6
by: naknak | last post by:
Introduction This assignment requires you to develop solutions to the given problem using several different approaches (which actually involves using three different STL containers). You will...
1
by: peterggmss | last post by:
This is a slot machine game, 2 forms. One is the actual game (frmMachine) and the other is in the background and randomizes the images shown on frmMachine. I need to make frmMachine wait for...
8
by: David Thielen | last post by:
Hi; In our setup program how do I determine if I need to run "aspnet_regiis –i" and if so, is there an API I can calll rather than finding that program on the user's disk and calling it? --...
4
by: shyamkumars | last post by:
Hi, I would like to know how can I make a daemon program in perl,say DP . The said program need to call a a program say A, which will to parse huge text file. The run time of A may vary say 5 to 6...
1
by: raghavshastri | last post by:
You are to write a C++ program to perform a statistical analysis of the blobs in an image. The image will be a grayscale image in PGM format for simplicity. Here is a sample PGM image with 10...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.