0% found this document useful (0 votes)
84 views5 pages

Object-Oriented Modeling and Programming in Engineering (OOMPE)

This document discusses data structures and provides exercises for students to complete. It begins by describing common data structures like arrays, lists, maps, trees, stacks, and queues. It then provides details for an exercise to implement a double linked list in Java with classes for nodes and the list. Another exercise asks students to design classes to model a network with routers to find routes between nodes. Finally, it provides an example UML diagram for classes to represent network nodes, edges, and a graph to solve this network routing problem.

Uploaded by

Angela Rose
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views5 pages

Object-Oriented Modeling and Programming in Engineering (OOMPE)

This document discusses data structures and provides exercises for students to complete. It begins by describing common data structures like arrays, lists, maps, trees, stacks, and queues. It then provides details for an exercise to implement a double linked list in Java with classes for nodes and the list. Another exercise asks students to design classes to model a network with routers to find routes between nodes. Finally, it provides an example UML diagram for classes to represent network nodes, edges, and a graph to solve this network routing problem.

Uploaded by

Angela Rose
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Faculty Civil Engineering

Chair of Intelligent Technical Design


Prof. Dr.-Ing. Christian Koch

Object-oriented Modeling and


Programming in Engineering (OOMPE)
Winter semester 2018-19

06 – Data structures
Structuring data

• Think about what is your data


 Composition of primitive data types, e.g. numbers, characters, boolean,
strings,… (most times easy)
 Think about how is your data related? (get to know some patterns)
• Array: multiple objects of the same type, fixed size (e.g. vectors,
matrices, images)
• List: multiple objects of the same type, variable size (e.g. users in a
system, stock in a ware house)
• Map: key-value pairs (e.g. user and password, id and username, …)
• Trees:
 hierarchical data (e.g. directories, models, structures)
 object groups (e.g. search within data, routing, travelling salesman)
• Stack: First in Last out (e.g. Backward function in Browser)
• Queue: First in First out (e.g. a queue)
• …

18/01/2019 Object-oriented modelling and programming – Exercise 6 2


double linked list

• Implement the classes needed for a ascending sorted


double list
 Design two classes: one for a node, one for the list
 Each node has to relating elements: previous and next
 previous of the list head points to the end of the list
 The list shall offer the following options:
• add a new double to it
• remove an element at a specified position
• Sort the list ascending

18/01/2019 Object-oriented modelling and programming – Exercise 6 3


Network diagram

• Think about a network with different routers


• Find a route from [start] to [end]
• Use 4 classes for this
 A class for a single node
 A class for a connection of two nodes
 A class for a network
 A class for testing (main method)

1 2 2
1
1 5 5
1

3 3 4

18/01/2019 Object-oriented modelling and programming – Exercise 6 5


UML Diagram

NetworkNode NetworkEdge
- number: int - related: NetworkNode
- neighbors: LinkedList<NetworkEdge> - cost: double
+ NetworkEdge(related: NetworkNode, cost: double)
+ getRelated(): NetworkNode
+ NetworkNode(number: int) + getCost(): double
+ getNeighbors(): LinkedList<NodeConnection>
+ addNeighbor(neigbor: NetworkNode, cost: double): void

NetworkGraph
- nodes: LinkedList<NetworkNode>

+ NetworkGraph()
+ addNode(node: NetworkNode): void
+ getRoute(start: NetworkNode, target: NetworkNode) : LinkedList<NetworkNode>

18/01/2019 Object-oriented modelling and programming – Exercise 6 6

You might also like