Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Tasks: 1 . Data Management Using Fundamental Structures: - Load and store given product data ( product _ data.txt ) into arrays or linked lists,

Tasks:
1. Data Management Using Fundamental Structures:
- Load and store given product data (product_data.txt) into arrays or linked lists, ensuring
efficient access and management. Products attributes are: ID, Name, Price, and Category.
2. Data Manipulation Operations:
- Insert: Efficiently add new products.
- Update: Modify existing product details.
- Delete: Remove products while preserving data structure integrity.
- Search: Efficiently find products using key attributes (e.g., ID, Name).
3. Sorting Algorithm Implementation:
- Apply Bubble or Insertion or Quick Sort to order product data by price. (No Library
Function is allowed)
4. Complexity Analysis:
- Record and compare the time taken to sort data that is already sorted, as well as data in
reverse order.
- Assess the best, average, and worst-case time complexities for sorting operations.
so far i have this much done but i dont know how to continue. please help.
# Initialize the product data directly
raw_product_data =[
"57353, Camera SBBHC,546.88, Electronics",
"40374, Smartphone ILGCU, 947.54, Electronics",
"34863, Biography XPESK, 287.31, Books",
"18086, Shirt ZQLTI, 439.07, Clothing",
"16041, Jacket OTBKQ, 986.73, Clothing",
"43566, Mystery COKPK, 836.57, Books",
"69260, Toaster FODKJ, 867.6, Home & Kitchen",
"30895, Knife Set KGFUF, 385.77, Home & Kitchen",
"19897, Blender DPKLR,488.62, Home & Kitchen",
"87296, Skirt IRTZX, 261.08, Clothing",
"68215, Laptop QLBQC,404.21, Electronics",
"68097, Camera SGSRZ,36.39, Electronics",
"26556, Novel METLI, 376.45, Books",
"30483, Knife Set WRSZZ,55.97, Home & Kitchen",
"62422, Camera VFQWS,382.69, Electronics",
"22806, Smartwatch VVFNT,203.55, Electronics",
"24976, Pants YZMAK, 449.56, Clothing",
"30631, Headphones JFGYQ,115.08, Electronics",
"27939, Textbook TWQKZ,108.5, Books",
"41355, Headphones JOUXM, 211.57, Electronics",
"94162, Laptop WRJOZ, 956.53, Electronics",
"28710, Dress FRSMO, 879.09, Clothing",
"90291, Pants TIPUD, 853.38, Clothing",
"20368, Shirt FQFPK,83.19, Clothing",
"68960, Blender OMDPS, 720.06, Home & Kitchen",
"40852, Novel IRROY, 603.68, Books",
"97895, Blender KSJHL,123.25, Home & Kitchen",
"96314, Cutting Board LUICX, 628.29, Home & Kitchen",
"85719, Laptop GZORF, 641.33, Electronics",
"98625, Mystery BOPTP, 160.68, Books",
"66208, Blender GCZSK,161.83, Home & Kitchen",
"86128, Biography ASTVE, 90.44, Books",
"10889, Shirt DNRZU, 316.48, Clothing",
"82777, Shirt OZWXU, 790.46, Clothing",
"43451, Mixer CKVJQ,379.5, Home & Kitchen",
"12848, Toaster VZXUE, 867.97, Home & Kitchen",
"17646, Biography BPWXR,424.83, Books",
"85197, Cutting Board IJVPP, 986.89, Home & Kitchen
]
# Initialize an empty list to store empty data
products =[]
# Process the raw product data
for line in raw_product_data:
# Split the line into components
product_id, name, price, category = line.split(',')
# Convert price to float and product_id to integer
price = float(price)
product_id = int(product_id)
# Create a dictionary for the product
product ={
'ID': product_id,
'Name': name,
'Price': price,
'Category': category
}
# Add the dictionary to the list
products.append(product)
# Print the products list to verify
for product in products:
print(product)
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions