ACTIVITY#17: DOCUMENTATION OF DATA STRUCTURE (Again) (Concept of list, object, and list of objects)

·

7 min read

Data Structures and Algorithms (DSA) refer to the study of methods for organizing and storing data and the design of procedures (algorithms) for solving problems, which operate on these data structures.

List- In programming, a list is a data structure that stores a collection of elements. It can hold objects of any type and allows for dynamic resizing.

student_Employee_list = ["Miguel", "Joshua", "Sebastian", "Christian", "Theo"]
student_Department_list = ["Finance", "Marketing", "IT", "Engineering", "HR" ]
student_Email_list = ["miguel@gmail.com", "HongJoshua.com", "Choisebastian@gmail.com", "YuChristian@gmail.com", "XuTheo@gmail.com" ]
student_Position_list = ["Senior management", "Digital marketing specialist", "Software engineer"]
, "Junior engineer"

Objects- An object represents a real-world entity with attributes and behaviors. In programming, objects are instances of classes and can have methods and properties.

Animals_dog = {
    "name": "Potchie",
    "Breed": Aspin,
    "Color": "Brown",
    "age": 3
}
Animals_cat = {
    "name": "Spam",
    "Breed": "Puspin",
    "Color": "White",
    "age": 3
}

List of objects- This refers to a list where each element is an object of a particular class or type. For example, a list of Employee objects could store instances of a Employee class, each containing attributes like name, age, department, email and position.

Employee = [
    {
        "name": "Mark Zukerburg ",
        "Department": "Engineering",
        "email": "MarkBeta.com",
        "postion": "Senior software developer",
        "age": 40
    },

In Product table 1 Each product's ID would be used as the key, while the rest of the product's details (name, category, price, stock, and supplier email) would be the value.

product_name =["laptop", "Deskchair", "smartwatch", "Notebook"]
product_Id =[1,2,3,4]
product_category=["Elctronics", "furniture", "electronics", "stationary"]
product_price= [750, 100, 200, 5]
product_stock=[50, 200, 150, 500]
product_supplier_email=["supplier1@gmail.com", "supplier2@gmail.com", "supplier3@gmail.com", "supplier4@gmail.com"]

In the object each product in the table represent as an object.

 Product1 = {
    "ID": 1,
    "Name": "Laptop",
    "Category": "Electronics",
    "Price": 750,
    "Stock": 50,
    "SupplierEmail": "supplier1@gmail.com"
};

 Product2 = {
    "ID": 2,
    "Name": "Desk Chair",
    "Category": "Furniture",
    "Price": 100,
    "Stock": 200,
    "SupplierEmail": "supplier2@gmail.com"
};

Product3 = {
    "ID": 3,
    "Name": "Smartwatch",
    "Category": "Electronics",
    "Price": 200,
    "Stock": 150,
    "SupplierEmail": "supplier3@gmail.com"
};

Product4 = {
    "ID": 4,
    "Name": "Notebook",
    "Category": "Stationery",
    "Price": 5,
    "Stock": 500,
    "SupplierEmail": "supplier4@gmail.com"
};

While in the List of objects is like a combination of list and object.Each product would have key-value pairs representing various properties of the product, such as name, price, category, and stock quantity.

products = [
    {
        product_id: 101,
        name: "Laptop",
        category: "Electronics",
        price: 1200,
        stock: 15
    },
    {
        product_id: 102,
        name: "Headphones",
        category: "Accessories",
        price: 200,
        stock: 40
    },
    {
        product_id: 103,
        name: "Coffee Mug",
        category: "Kitchenware",
        price: 10,
        stock: 100
    }
];

Employee table 2

Employee_id= [1,2,3,4,5]
Employee_Name = ["John Doe", "Jane Smith", "Mark Johnson", "Lisa Wong", "Paul Mcdonald"]
Employee_Department =["Sales,  "Hr", "IT", finance", "Marketing"]
Employee_Age =[30, 25 , 40, 28, 35]
Employee-Email=["john.doe@company.com", "jane.smith@company.com", "mark.johnson@company.com", "lisa.wong@company.com", "paul.mcdonald@company.com"]

Object

employee_1 = {
    id: 1,
    name: "John Doe",
    department: "Sales",
    age: 30,
    email: "john.doe@company.com"
};

employee_2{
    id: 2,
    name: "Jane Smith",
    department: "hr",
    age: 25,
    email: "janesmith@company.com"
}

employee_3{
    id: 3,
    name: "Mark Johnson",
    department: "IT",
    age: 40,
    email: "MarkJhonson@company.com"
}
employee_4{
    id: 4,
    name: "Lisa Wong",
    department: "Finance",
    age: 28,
    email: "LisaWong@company.com"
}
employee_5{
    id: 5,
    name: "Paul Mcdonald",
    department: "Finance",
    age: 25,
    email: "PaulMcdonaldcompany.com"
}

List of objects

Employee =[
 {
    id: 1,
    name: "John Doe",
    department: "Sales",
    age: 30,
    email: "john.doe@company.com"
};

employee_2{
    id: 2,
    name: "Jane Smith",
    department: "hr",
    age: 25,
    email: "janesmith@company.com"
}

employee_3{
    id: 3,
    name: "Mark Johnson",
    department: "IT",
    age: 40,
    email: "MarkJhonson@company.com"
}
employee_4{
    id: 4,
    name: "Lisa Wong",
    department: "Finance",
    age: 28,
    email: "LisaWong@company.com"
}
employee_5{
    id: 5,
    name: "Paul Mcdonald",
    department: "Finance",
    age: 25,
    email: "PaulMcdonaldcompany.com"
}
]

Table 3, Books table

List

Book_id_table = [1,2,3,4,5]
Book_Title =["The Great Gatsby", "To Kill a Mockingbird", "1984", "The Catcher in the Rye", "A Brief History of Time"   ]
Book_Author =["F. Scott Fitzgerald", "Harper Lee", "George Orwell", "J.D. Salinger", "Stephen Hawking"]
Book_genre = ["Fiction", "Fiction", "Dystopian", "Fiction", "Non-fiction" ]
Book_Published_year =["1925", "1960", "1949", "1951", "1988" ]
Book_ISBN =["978-0743273565", "978-0060935467", "978-0451524935", "978-0316769488", "978-0553380163"]
Book_Stock =["20", "35", "40", "25","10"]
Book_Price =[15.99, 10.99, 9.99, 8.99, 18.99]

List

    Books_list1{
        "ID": 1,
        "Title": "The Great Gatsby",
        "Author": "F. Scott Fitzgerald",
        "Genre": "Fiction",
        "Published_Year": 1925,
        "ISBN": "978-0743273565",
        "Stock": 20,
        "Price": 15.99
    },
    Books_list2{
        "ID": 2,
        "Title": "To Kill a Mockingbird",
        "Author": "Harper Lee",
        "Genre": "Fiction",
        "Published_Year": 1960,
        "ISBN": "978-0060935467",
        "Stock": 35,
        "Price": 10.99
    },
    Books_list3{
        "ID": 3,
        "Title": "1984",
        "Author": "George Orwell",
        "Genre": "Dystopian",
        "Published_Year": 1949,
        "ISBN": "978-0451524935",
        "Stock": 40,
        "Price": 9.99
    },
    Books_list4{
        "ID": 4,
        "Title": "The Catcher in the Rye",
        "Author": "J.D. Salinger",
        "Genre": "Fiction",
        "Published_Year": 1951,
        "ISBN": "978-0316769488",
        "Stock": 25,
        "Price": 8.99
    },
    Books_list5{
        "ID": 5,
        "Title": "A Brief History of Time",
        "Author": "Stephen Hawking",
        "Genre": "Non-fiction",
        "Published_Year": 1988,
        "ISBN": "978-0553380163",
        "Stock": 10,
        "Price": 18.99
    }

list of object


books = [
    {
        "ID": 1,
        "Title": "The Great Gatsby",
        "Author": "F. Scott Fitzgerald",
        "Genre": "Fiction",
        "Published_Year": 1925,
        "ISBN": "978-0743273565",
        "Stock": 20,
        "Price": 15.99
    },
    {
        "ID": 2,
        "Title": "To Kill a Mockingbird",
        "Author": "Harper Lee",
        "Genre": "Fiction",
        "Published_Year": 1960,
        "ISBN": "978-0060935467",
        "Stock": 35,
        "Price": 10.99
    },
    {
        "ID": 3,
        "Title": "1984",
        "Author": "George Orwell",
        "Genre": "Dystopian",
        "Published_Year": 1949,
        "ISBN": "978-0451524935",
        "Stock": 40,
        "Price": 9.99
    },
    {
        "ID": 4,
        "Title": "The Catcher in the Rye",
        "Author": "J.D. Salinger",
        "Genre": "Fiction",
        "Published_Year": 1951,
        "ISBN": "978-0316769488",
        "Stock": 25,
        "Price": 8.99
    },
    {
        "ID": 5,
        "Title": "A Brief History of Time",
        "Author": "Stephen Hawking",
        "Genre": "Non-fiction",
        "Published_Year": 1988,
        "ISBN": "978-0553380163",
        "Stock": 10,
        "Price": 18.99
    }
]

Table 4, University table

List

University_id =[1,2,3,4,5]
University_name =["University of the Philpiines", "Ateneo de Manila Unversity", "De la salle uversity", "University of Santo thomas", "Polytechnic University of the Philippines']
University_location =["Quezon city", "Quezon city", "Quezon city", "Manila", "Manila" ]
University_Published_year =[1908, 1859, 1911, 1611, 1904]
University_type =["Public", "Private", "Private", "Private", "Private""Public", ]
University_website=["www.up.edu.ph","www.ateneo.edu.ph","www.dlsu.edu.ph","www.ust.edu.ph","www.pup.edu.ph"]

Object

university_up = {
    "id": 1,
    "name": "University of the Philippines",
    "location": "Quezon City",
    "established_year": 1908,
    "type": "Public",
    "website": "www.up.edu.ph"
}

university_Admu = {
    "id": 2,
    "name": "Ateneo de Manila University",
    "location": "Quezon City",
    "established_year": 1859,
    "type": "Private",
    "website": "www.ateneo.edu"
}

university_Dlsu = {
    "id": 3,
    "name": "De La Salle University",
    "location": "Manila",
    "established_year": 1911,
    "type": "Private",
    "website": "www.dlsu.edu.ph"
}

university_ust = {
    "id": 4,
    "name": "University of Santo Tomas",
    "location": "Manila",
    "established_year": 1611,
    "type": "Private",
    "website": "www.ust.edu.ph"
}

university_pup = {
    "id": 5,
    "name": "Polytechnic University of the Philippines",
    "location": "Manila",
    "established_year": 1904,
    "type": "Public",
    "website": "www.pup.edu.ph"
}

List of objects

Universities[
university_up = {
    "id": 1,
    "name": "University of the Philippines",
    "location": "Quezon City",
    "established_year": 1908,
    "type": "Public",
    "website": "www.up.edu.ph"
}

university_Admu = {
    "id": 2,
    "name": "Ateneo de Manila University",
    "location": "Quezon City",
    "established_year": 1859,
    "type": "Private",
    "website": "www.ateneo.edu"
}

university_Dlsu = {
    "id": 3,
    "name": "De La Salle University",
    "location": "Manila",
    "established_year": 1911,
    "type": "Private",
    "website": "www.dlsu.edu.ph"
}

university_ust = {
    "id": 4,
    "name": "University of Santo Tomas",
    "location": "Manila",
    "established_year": 1611,
    "type": "Private",
    "website": "www.ust.edu.ph"
}

university_pup = {
    "id": 5,
    "name": "Polytechnic University of the Philippines",
    "location": "Manila",
    "established_year": 1904,
    "type": "Public",
    "website": "www.pup.edu.ph"
}
]

Table 5 , Restaurant table

List

Restaurant_id =[1,2,3,4,5]
Restaurant_name =["Vikings luxury buffet", "Antonio's restaurant", "Mesa Filipino moderne", "Mana comfort filipino", "Ramen nagi"]
Restaurant_location =["pasay city", "tagaytay city", "Makati city", "Quezon", "Various location" ]
Outlint_type =["Buffet", "Fine dining", "Filipino", "Filipino", "Japanese"]
Restaurant_Established_year =["2011", "2002", "2009", "2015", "2013' ]
Restaurant_website=["www.vikings.ph","www.Antoniosrestaurant.ph","www.MesaFilipinomoderne.ph","www.Manacomfortfilipino.ph","www.ramennagi.ph"]

Object

restaurant_1 =   {
        "ID": 1,
        "Name": "Vikings Luxury Buffet",
        "Location": "Pasay City",
        "Cuisine Type": "Buffet",
        "Established Year": 2011,
        "Website or Contact": "www.vikings.ph"
    },
    restaurant_2{
        "ID": 2,
        "Name": "Antonio's Restaurant",
        "Location": "Tagaytay",
        "Cuisine Type": "Fine Dining",
        "Established Year": 2002,
        "Website or Contact": "www.antoniosrestaurant.ph"
    },
    restaurant_3{
        "ID": 3,
        "Name": "Mesa Filipino Moderne",
        "Location": "Makati City",
        "Cuisine Type": "Filipino",
        "Established Year": 2009,
        "Website or Contact": "www.mesa.ph"
    },
    restaurant_4{
        "ID": 4,
        "Name": "Manam Comfort Filipino",
        "Location": "Quezon City",
        "Cuisine Type": "Filipino",
        "Established Year": 2013,
        "Website or Contact": "www.manam.ph"
    },
    restaurant_5{
        "ID": 5,
        "Name": "Ramen Nagi",
        "Location": "Various Locations",
        "Cuisine Type": "Japanese",
        "Established Year": 2013,
        "Website or Contact": "www.ramennagi.com.ph"
    }

List of objects

restaurants = [
    {
        "ID": 1,
        "Name": "Vikings Luxury Buffet",
        "Location": "Pasay City",
        "Cuisine Type": "Buffet",
        "Established Year": 2011,
        "Website or Contact": "www.vikings.ph"
    },
    {
        "ID": 2,
        "Name": "Antonio's Restaurant",
        "Location": "Tagaytay",
        "Cuisine Type": "Fine Dining",
        "Established Year": 2002,
        "Website or Contact": "www.antoniosrestaurant.ph"
    },
    {
        "ID": 3,
        "Name": "Mesa Filipino Moderne",
        "Location": "Makati City",
        "Cuisine Type": "Filipino",
        "Established Year": 2009,
        "Website or Contact": "www.mesa.ph"
    },
    {
        "ID": 4,
        "Name": "Manam Comfort Filipino",
        "Location": "Quezon City",
        "Cuisine Type": "Filipino",
        "Established Year": 2013,
        "Website or Contact": "www.manam.ph"
    },
    {
        "ID": 5,
        "Name": "Ramen Nagi",
        "Location": "Various Locations",
        "Cuisine Type": "Japanese",
        "Established Year": 2013,
        "Website or Contact": "www.ramennagi.com.ph"
    }
]