Thread: Help require for some data structure topics

  1. #1
    Registered User jawwadalam's Avatar
    Join Date
    May 2002
    Posts
    131

    Help require for some data structure topics

    I have to prepare for my paper of Data structure, the problem is that I could not find some topics (Related to questions asked in some old papers) in books and I also searched alot on the web ... but I could not find any helpful link for the topics.
    Topics follows...

    • A question asked in paper was to differentiate b/w Primitive and Non-Primitive data types. I could only find Primitive data types but could not find Non-Primitve Data types.
    • I read book of data structure from start but I could not find Physical and Logical Data structre



    Believe me this is not homework...

    Help ...

  2. #2
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    hmm
    i'm at a lost too

    sounds like primitive is comparable to
    char theCString[40];

    and non primitive is comparable to
    string theC__String;

    see what i'm getting at?

    as for the other stuff i'd have to think for a while.
    PHP and XML
    Let's talk about SAX

  3. #3
    Registered User jawwadalam's Avatar
    Join Date
    May 2002
    Posts
    131
    What I have found from a book finding Primitive and Non-Primitive Data types... is Primitive Data Structures

    Book Explains about Primitive data structures that ,
    The data sturues that typicall are directly operated upon by machine-level instruction

    What else I have extracted from 2 more pages after above defination... is that. four basic operations are applied to primitive data strucutres(I think we can call data types... ?)

    1. Create
    2. Destroy
    3. Selection
    4. Update.

    The writer explained this with the integer variable and real..
    The writer has also written that

    The four operation just discussed provide us with all the operations that are normall applied to the primitive data structures that will be discussed in the chapter (Integer and Real) In procedure-oriented languages such as Pascal and FORTRAN, a primitive data structure is equated with a simple variable such as a real variable, integer variable, logical variable(I cant understand) etc. A simple variable is assigned a single value such as a real value. The single value associated with a simple variable is referenced through a simple indentifier name such as X

    Book: An Introduction to Data structures with Applications
    by: Jean-Paul Tremblay and Paul G. Sorenson
    Publisher: McGraw Hill
    ------------------------------
    After reading the whole stuff i could not make out any special thing about Primitive data types and Non-Primitive data types..
    because next chapters are blank about Non-Primitve data types.
    ..
    One day you will ask what more important to you..
    I will say my life..
    and You will leave me with even knowing
    that
    You are my Life (L)

  4. #4
    Microsoft. Who? MethodMan's Avatar
    Join Date
    Mar 2002
    Posts
    1,198
    I thought primitive data types were considered those that are basic to any language, such as char, int and double for ex. Non-primitive data types (structures?) would be those that are built using those primitives, such as lists and stacks. etc..
    -MethodMan-

    Your Move:Life is a game, Play it; Life is a challenge, Meet it; Life is an opportunity, capture it.

    Homepage: http://www.freewebs.com/andy_moog/home.html

  5. #5
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Exactly. Integers, doubles, chars, etc == primitive.
    Structures, classes and others == non-primitive.

    1. Create
    2. Destroy
    3. Selection
    4. Update.

    That is meaningless. These operations can be applied to any data structure.


    A physical data structure relates to layout in memory, physical connections, etc.

    ie:

    struct Packet {
    char buff[1000];
    //...
    char * base = buff;
    char * header = base+10;
    char * data = header+246;
    char * footer = data+ 700;
    char * end = buff[999];
    };

    void MakePacket(struct Packet * p, const char * b){
    //...
    }



    Logical data structures relate to mental layout, and mental connections, etc.

    class Network {
    List <Packet*> packets;
    bool Send(const char * b){
    Packet * p = new Packet;
    MakePacket(p, b);
    Out(p);
    //...etc...
    }
    };
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  6. #6
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Primitives are the datatypes that can't be split, like int and char (as have been mentioned). Structures and classes on the other hand usually consists of int:s and char:s, and are not primitives.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  7. #7
    CS Author and Instructor
    Join Date
    Sep 2002
    Posts
    511

    Thumbs up

    Sebastiani and Magos- are correct. We don't call them primative data types in C/C++ but that's what they are called in Java.

    As for a book on logical and physical DS check out C++ Data Structures by N. Dale. It talks about DS implementation at the phyiscal and logical levels!
    Mr. C: Author and Instructor

  8. #8
    Registered User jawwadalam's Avatar
    Join Date
    May 2002
    Posts
    131

    Thanxxxxxxx :)

    Thanx Thanx... Now I am pretty cleared with my questions...
    Thanx again for the help..
    One day you will ask what more important to you..
    I will say my life..
    and You will leave me with even knowing
    that
    You are my Life (L)

  9. #9
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    Primitives and non-primitives depends on the language.
    For example a c++ string is not a primative type but
    a java String is. Also in lisp, list are primitive types but
    in c++ they are not.

  10. #10
    CS Author and Instructor
    Join Date
    Sep 2002
    Posts
    511

    Talking


    Primitives and non-primitives depends on the language.
    For example a c++ string is not a primative type but
    a java String is. Also in lisp, list are primitive types but
    in c++ they are not.
    Strings are NOT primatives in Java they are objects. Check the JLS
    java.sun.com/docs/books/jls/second_edition/html/typesValues.doc.html#26992
    Mr. C: Author and Instructor

  11. #11
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    Strings are NOT primatives in Java they are objects. Check the JLS
    java.sun.com/docs/books/jls/second_edition/html/typesValues.doc.html
    Just because there're objects
    doesn't make them non-primitives. In smalltalk
    integers, arrays etc are all objects. The reason why I said
    strings in java are primatives is the way it
    handles expressions such as
    "hello, " + "bye". You cannot reprecate
    the strings of java using the java language. In c++
    it's possible to define a String that behaves exactly
    like the c++ std string. Primatives is kind of a
    vague term and probably every book has a different way
    of defining it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Include GTK+ just for a data structure?
    By Jesdisciple in forum C Programming
    Replies: 0
    Last Post: 04-12-2009, 07:19 PM
  2. pthread question how would I init this data structure?
    By mr_coffee in forum C Programming
    Replies: 2
    Last Post: 02-23-2009, 12:42 PM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. Data structure question.
    By ronenk in forum C Programming
    Replies: 9
    Last Post: 10-03-2004, 10:58 AM
  5. vector static abstract data structure in C?
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 11-05-2001, 05:02 PM