Programming :: C Language Data Structure/ Algorithm Info Requested
Apr 2, 2010Does anyone know of a C Language Data Structure Tutorial? I have not been able to find anything much to speak of myself.
View 4 RepliesDoes anyone know of a C Language Data Structure Tutorial? I have not been able to find anything much to speak of myself.
View 4 RepliesIve read a few books and a lot of tutorials on C but can't find this topic explained in a deliberate way.I can find bits and pieces but nothing thorough.
View 9 Replies View RelatedI have a mxn matric (which is my simplified way of saying it is RAM with bytes on it) Some of the locations on this metric is filled with some data and some places are empty. The mxn are very big numbers in size. I am trying to make a program so that if a system call wants to write some thing on empty locations on this mxn metric it should be able to do so without any problem. The thing which I want to understand or logic of a data structure is what data structure do you people feel should I be maintaining so that I can allocate the requested space immediately from the above mxn matric when some system call requests for some (k) number of locations from above metrics.
The logic initially I thought was to maintain a hashtable
1bytes requested----------> location 1,location 2,location 3.........location n
2bytes requested----------> location 1,location 2,location 3.........location n
3bytes requested----------> location 1,location 2,location 3.........location n
[code]....
but the problem with above logic is size of the pointers where I will be writing this problem is unsigned 64 byte.So to know location of one free byte if I am maintaining one pointer of type u64 this is not a feasible solution.
Options:A double linked list with fixed size character arrays. New nodes will be added when previous ones get filled. Dynamic arrays using realloc(). Linked list has the disadvantage of not having an O(1) search like an array but I think using realloc() will be more dangerous since it moves the whole block to a new location and if the new location is not big enough to hold the whole block, realloc fails !! this case will not occur with the linked list since its nodes are scattered.
View 14 Replies View RelatedI am writting a program that reads a text file (music.txt) & stores it in a Data Structure. I am a novice learning over the internet so I this is something I have never done. How do I do this?
Quote:
Write a program that reads the data from the music.txt file and store it in a data structure. To implement this data structure you must use an array of songs and each song must be represented by a struct with appropriate fields. So far all I can do is open to file to read it (very simple I know) but so far is it correct?
Code:
#include <iostream>
#include <fstream>
#include <strstream>
[code]....
I am in deeply need of queue (linear data structure) in shell script. How can I implement this ??
View 2 Replies View Relatedi used my windows box to connect to ftp(fed box) and i keep getting an error saying "The requested name is valid, but no data of the requested type was found." does anyone know why i cant connect?
View 1 Replies View RelatedWhat elements of the Perl language could you use to structure your code to allow for maximum re-use and maximum readability?
View 2 Replies View RelatedI have installed the Ubuntu distro first in Portuguese. Then, I decided I wanted the English language. I would like that the default folders like "Desktop" and "Documents" were renamed to this names, instead of staying in their Portuguese equivalent.
I can not guarantee this, but I am almost certain I did successfully convert the folder names from Portuguese to English on a previous install when I decided to change the language. So, I suppose this is possible.
I have searched all over. I cannot find any info on the description of the Fedora mirror release directory structure and the reason for having a "Fedora" and "Everything" directory? Yes I looked at [URL] I mostly work with the Red Hat 5.x. The Fedora release software is kept on a mirror and the DVD release as, (using i386 release):
[Code]....
user@ubuntu:~/Documents/C$ man host_ent No manual entry for host_ent How to install the manpage for host_ent or in_addr under ubuntu?
View 1 Replies View RelatedWhwn I am sending mails , I used too get message like
Host found but no data record of requested type.
MTA: postfix
I'm trying to get a complete overview of booting so I can multiboot. An explanation of the hardware that stores data and the hardware that runs it with the paths the data takes would be awesome!
Here are some quotes that are not comprehensive.
Quote from [url] "When the processor first starts up, it is suffering from amnesia; there is nothing at all in the memory to execute. Of course processor makers know this will happen, so they pre-program the processor to always look at the same place in the system BIOS ROM for the start of the BIOS boot program. This is normally location FFFF0h, right at the end of the system memory. They put it there so that the size of the ROM can be changed without creating compatibility problems. Since there are only 16 bytes left from there to the end of conventional memory, this location just contains a "jump" instruction telling the processor where to go to find the real BIOS startup program."
System Memory is your RAM is it not? Why are they being specific in stating the address location in the Firmware that BIOS uses? An external EEPROM on the board is totally different from RAM is it not? Does the BIOS data travel to a specific RAM Location?
Is there a small processor connected to BIOS or is everything run with the Main CPU?
What exactly is the "chipset" that is referred to with booting?
Can I know the implemention of RSA(Encryption and decryption) algorithm in C / C++.
View 1 Replies View RelatedI have a copy of the MD5 algorithm and I'm taking a look at the source. It's pretty interesting but there are a few things that I'm curious about and I was wondering if anyone a bit more intuitive than I could help me out.The function declarations in the MD5 files are a bit unfamiliar to me. There is a macro used called PROTO_LIST, which I'm still not sure as to what this thing is doing exactly, but it's littered everywhere throughout the source.The signature here isn't too unfamiliar to me with the exception of the position of the PROTO_LIST macro. So here is a function with an unnamed argument of type MD5_CTX*.To me, this resembles an initializer list found in C++ with constructors but I certainly don't think that is the case here. So my questions about this are (1) how is this legal code in C and (2) what functionality has the PROTO_LIST macro provided for the function?
View 3 Replies View RelatedI'm pretty new to linux, and I'm facing a problem with an ext3 partition on an external hdd. I'm not sure whether the hdd is about to crash or not, however I've had a few problems accessing it in the past.
I have a second external hdd, the exact same drive, that has the exact same partition configuration, but holds different data. So, my question is; is it possible to backup the partition structure of the second working drive, and using this information to rewrite the partition structure of the failing hdd without damaging the data stored on that drive?
What is the best and simplest way to compare two directory structures without actually comparing the data in files. This works fine:
diff -qr dir1 dir2
But it's really slow because it's comparing files too. Is there a switch for diff or another simple cli tool to do this?
We want to fix our data folders structre in Samba, for example our folders would be like as Data/Group A/2010 /A.We want all our users can work only in folder A and no one can create any files in data, GroupA, 2010 folders. Similarly no one can delete these basic folders. However users can create further folders in A as required.
View 1 Replies View RelatedI have a timer thread, and when it expires, it sets a flag. The only problem is, if any higher priority thread comes in between, then the timer is not expired in real time.Thus i want to set a highest priority to my thread. Now, i know 2 algos, which can make my thread in real time are: SCHED_FIFO and SCHED_RR.
So, here are my queries: 1) Which scheduling algo is best suited for this purpose? 2) Is it guaranted to work in real time if i use that algo (you suggest in 1) and set the max_priority by getting the maximum settable priority for that particular algorithm using, int sched_get_priority_max(int policy);
I've got a bit of an obscure question for you to test your brains a wee bit. I'm trying to implement a search program to find areas of high density in a binary string.
E.g.
Code:
[0001001010
0001110001
0000001000
1001000010
0101100100]
Where density is the number of 1's / number of digits with a maximum number of digits being the current number in a buffer (in this example 50). So for the example the density for the whole buffer is 15/50. But the density of Buffer[14..20]=[1110001]=4/7. So if looking for areas of density = 1/3 it would find the longest sequences of density over 1/3.So in the example. Buffer[4..9]=[100101]=3/6=1/2 which is above 1/3 but it is within the Buffer[4..48]=[100101000011100010000001000100100001001011001]=15/45=1/3
I have an algorithm guys called "Self Configurable Diagnosis Algorithm" but i don't have program for this.help me regarding that program and which type of Tcl script will be better suitable for that.
View 3 Replies View RelatedI have two functions:
Quote:
void func1(std::string &s)
{
s.clear();
}
[code]....
Is there a way to create one template function for both vector and string that would clear them?
I need to simulate dijsktra's algorithm using network animator of ns2. how to write a tcl script for my code. This tcl script runs the dijsktra code and simulates its running on network animator.
View 1 Replies View RelatedAStar works on the basis of straight lines, AFAIK. In my case, we have geocoordinates and I can get the straight line distance between the waypoints. But I am wondering how approximate will the route calculated on this basis be? The actual distance "by road", which actually matters can be different.
Example. Assuming A and B are on the same plane, and will be equidistant from the goal point, if we consider a straight line between A and the goal point and, B and the goal point. The distance "by road" between A and the goal point may be greater or lesser than B. But because the AStar works on the basis of straight lines, it will return both the routes as the shortest. If yes, then which algo should be considered , if we want the results on the basis of actual distance in Km/m?
i need a program for Encryption and Decryption using RSA algorithm in JAVA ..
View 9 Replies View Relatedi try to understand this algorithm but i cann't. [URL] I encounter problem understand the algorithm of fixed base windowing exponentiation algorithm ? What is fixed base in the first place ? How this algorithm works ?
View 5 Replies View Relatedidentify the right network structure for a data intensive website, built on LAMP. I'm thinking of a load balanced website, and that it should have a mysql master/slave setup server. I'm no expert in this area, so any online resources are welcome. You can check out the website [URL] - but it will have 10 million items once the hardware can support it.
View 1 Replies View Relatedalgorithm:breada
input: file system block number for immediate read
file system block number for asynchronous read
output:buffer containing data for immediate read {
if(first block not in cache) {
get buffer for first block
if(buffer data not valid)
initiate disk read }
if(second block not in cache) {
get buffer for second block)
if(buffer data valid) //line 1
release buffer else
initiate disk read //line 2 }
if(first block was originally in cache) //line 3 {
read first block
return buffer }
sleep (event first buffer contains valid data)
return buffer }
Here is an algorithm for block read algorithm. I have problem in
line 1: If buffer data is valid why is it releasing the buffer?
line 2: If buffer data valid why is it initiating disk read. It should have read directly from buffer?
line 3: It should be the first condition as if it is there in cache then it should return it without delay?
The algorithm for reading and writing disk blocks use the algorithm getblk to allocate buffers from the pool. In the algorithm getblk, if the kernel removes a buffer from the free list, it must raise the processor priority level to block out interrupts before checking the free list. Why ?Where can i find the C implementation of the above algorithm for buffer allocation in the linux source code ?
View 1 Replies View RelatedI am going to write a function which will do different operation base on the data type of the input parameter.
I am using C (Pure C, not C++).
The problem is that I do not know how to get the data type of the input parameter in C Language.
Can anyone tell me how to do this.