Constraint

This is a discussion on Constraint within the C Programming forums, part of the General Programming Boards category; Can somebody help me using constraint in linked list? Actually I don't know about constraint. May be you can tell ...

  1. #1
    Uli
    Uli is offline
    Registered User Uli's Avatar
    Join Date
    Dec 2013
    Posts
    12

    Question Constraint

    Can somebody help me using constraint in linked list?
    Actually I don't know about constraint. May be you can tell me clearly.
    Thank you

  2. #2
    Registered User
    Join Date
    Jun 2005
    Posts
    6,620
    Maybe you could ask your question more clearly.

    From an english language dictionary, the applicable definition is simple: "Constraint (n): limitation or restriction"

    In the context of linked lists, constraints would often be related to complexity of operations on the list. For example, the time to find the first or last element might be amortised constant (i.e. independent of the number of nodes in the list). The time to insert a new node might also be amortised constant. The average time to find a particular node in the list might linear with size of the list (i.e. double the number of nodes in the list, then the average time to find a particular node also doubles).

    Constraints might also be relevant to the overhead associated with adding a node to the list. For example, when adding a new node to a linked list of ints, the node will include an int as well as other overhead related to managing the list. The amount of this overhead per node depends on the type of list (e.g. a doubly linked list often has twice the memory overhead per node as a singly linked list, but some operations on a list might be faster).

    Since there is more than one type of linked list, each one probably is subject to a different set of constraints. I've already mentioned the memory overhead - the constraint on memory usage for a single linked list differs from the constraint for a double linked list.


    There are also constraints related to quality of implementation or correctness of code that affects the list. For example, when inserting a new node into a list X, a constraint might that no other list (say Y) would be affected.



    But, then, your question is unclear. That imposes a constraint on the quality of my answer - the only answer I can give relies on a guess about what you mean. Because of that constraint, I may have inadvertently given a completely incorrect answer.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Sunshine, and read this, this, and this before posting again.

  3. #3
    Uli
    Uli is offline
    Registered User Uli's Avatar
    Join Date
    Dec 2013
    Posts
    12
    So, to declare a constraint, we can use constant?

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Quote Originally Posted by Uli View Post
    So, to declare a constraint, we can use constant?
    There are programming languages where you can declare a constraint (eg specialized languages for doing linear programming). C is not one of them.

    If you mean something more like a parameter ("Today I want the value of gravity to be 6.98") then a constant may be appropriate there. If you want to specify a range, then that falls under setting your algorithm up correctly and nothing to do with the language itself.

  5. #5
    Uli
    Uli is offline
    Registered User Uli's Avatar
    Join Date
    Dec 2013
    Posts
    12
    oh, I see...
    Thank you very much.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SQL Constraint Syntax and Use
    By BrockDeanMunro in forum Tech Board
    Replies: 2
    Last Post: 04-24-2013, 12:17 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21