Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4013718
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:24:23+00:00 2026-05-20T09:24:23+00:00

My linked list is about a video store . I should make a list

  • 0

My linked list is about a video store .
I should make a list with video details ( I know this part) and a list of customer details.
Now the CUSTOMER list (The second nodetype) is where my problem lies.

I have to display the customer’s name ,acc no. etc AND the videos checked in and out by that customer (deleting and inserting videos to the customer list)
So my doubt is ,how do i do this deletion and insertion of JUST videos under a single person s name..

EG: Customer list has lots of different customers with different names and acc numbers and rented videos.

One customer john rents 2 or 4 different videos and rented out some videos too.

now HOW do I show that ONLY John rented these videos (that is i ve to insert videos under his name only and not any other customer)

I hope now people got me…I want to know how this can be done?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T09:24:23+00:00Added an answer on May 20, 2026 at 9:24 am

    If I understand correctly, this is a design question, and has nothing to do with linked lists in C++.

    For the rest of the implementation, I assume the following:

    1. There are N videos.
    2. The are currently K rentals, where 0 <= K <= N.
    3. There are M customers. There is no relationship between N and M, but it would be safe to assume that there may be many more customers than videos and that most of the time, most of the videos are not rented (M much larger than N, which is much larger than K).
    4. You’re starting, so you don’t know about classes, std::string or std::list.
    5. You have the following struct/classes.

      struct Customer {
      int account_number;
      char * name;
      // … other customer info …
      };

      struct Video {
      char * title;
      // … other video info …
      };

    Solution 1: per-customer list of rentals

    Add a “list of rentals” your Customer class. This is convenient for listing rentals by customer, but is problematic when you need to validate that a video is not already rented. The first is constant-time, but the second is linear in M+K (loop over all customers, then each customer’s rentals).

    #define MAX_RENTALS 5
    struct Customer {
        // regular fields, see above.
        // ...
        Video rentals[MAX_RENTALS];
        int rental_count;
    };
    

    Solution 2: per-video pointer to customer

    Add a “point to customer” in your Video class. Checking if a video is not already rented is constant time (check if video->customer is set to some non-default value — NULL in C, null in Java, None in Python, etc.), but listing movies rented by a specific customer is linear in N.

    struct Video {
        // regular fields, see above.
        // ...
        Customer * rented_to;
    };
    

    Solution 3: list of rentals

    Add a 3rd list to track rentals separately. Define a Rental class that has a pointer to Customer and a pointer to Video. Then, define a list of rentals. Listing all rentals by a customer and checking if a video is already rented are both linear in K.

    #define MAX_RENTALS 100
    struct Rental {
        Video * video;
        Customer * customer;
    };
    Rental rentals[MAX_RENTALS];
    int rental_count = 0;
    

    This solution gives you the best algorithmic complexity and also happens to mimic more closely what you’d do with an SQL database in a real commercial application for tracking a video store’s customers, videos and rentals.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Visual Studio 2008 C What I can't understand about this linked list is the
Please explain what this task is about? Create a generic linked list class that
I have a linked list that I want to sort part of, eg: std::sort(someIterator,
What's the best way to store a linked list in a MySQL database so
My question is about removing duplicates from a linked list. But i want to
I posted a question a few days ago about a linked list in C.
What is a doubly linked list's remove method?
For a simple linked list in which random access to list elements is not
I created a Linked List, with insert, search and remove functions. I also created
I have implemented a linked list as a self-referencing database table: CREATE TABLE LinkedList(

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.