All Questions
Tagged with design-patterns algorithm
23 questions
4
votes
2
answers
530
views
Simple Java program to aggregate lines of a text file
I have just written a small application to aggregate the lines of a text file, for example to group the lines according to the frequency of IP addresses in a log file.
Would the code be sufficiently ...
6
votes
0
answers
168
views
Efficiently generate distinct subsets which sum to a particular value
Related: Find all distinct subsets that sum to a given number
This code is supposed to efficiently generate all subsets of a list such that the subset's values sum to a particular target value. For ...
2
votes
2
answers
197
views
Parking places design
I got a question:
Design a parking system. There are 3 types of parking spaces: big, medium and small.
Implement ParkingSystem class(int big, int medium, int small)....
2
votes
0
answers
185
views
Design a parking lot [closed]
I have tried to design the parking lot problem. Here is the problem statement.
Design a parking lot with multiple floors where customers can park
their cars. Each parking floor will have many parking ...
1
vote
1
answer
99
views
Soduku Generator and Solver
This is my approach on creating a sudoku generator and solver with backtracking.
Is right for sudoku generator to inherit from soduku solver?
What is your general overview on the class structure, data ...
2
votes
0
answers
66
views
Generic Graph Traverser
I have built this Generic Graph traverser, I have this implemented with DFS, I feel it will work equally fine with BFS too.
What do you think of this implementation?
I want help in reviewing the <...
3
votes
2
answers
111
views
Print input one word per line (K&R 1-12 exercise) attempt
I'm currently trying to learn C from the K&R book, reading through and attempting the exercises. I came across exercise 1-12 yesterday and was a little stumped but managed to complete it. I was ...
5
votes
1
answer
120
views
Staff Scheduler: Design/Algorithm questions (Python)
Background
I worked at a community center where everyday one of my coworkers would spend 20ish minutes trying to organize the day's schedule. The facility had three rooms: The Great Hall, The Club ...
3
votes
1
answer
464
views
How to design shopping cart Java application which satisfy modular, extensible and maintainable
I am new in Application Design. I have use-case as below
As per the above story I have implemented code as below without any Modularity, Extensible and Maintainable. Could someone share the thoughts ...
2
votes
1
answer
168
views
Find closest elements in an array relative to given index with a bias to distance from index and direction
This function determines which images should be loaded based on which image is currently in the viewport (array index), what direction the user is scrolling, and if the image has yet to be loaded. It ...
3
votes
1
answer
70
views
Calculating direction based on index of array
I am comparing the index of the current component displayed in the viewport against an array of all the components on the screen to determine to direction the user in scrolling.
Does this function ...
1
vote
2
answers
642
views
How to make this code of shortest Path Finder more maintainable,extendable and get better static code analysis result?
I have the below code for finding the shortest path between a source node and destination node in a BiDirectional graph.It is working alright.
However, when I am running Static Code Analysis (VS2017), ...
4
votes
1
answer
6k
views
Basic Internet banking application
I programmed in Java before, but I feel that I lack the "true way" of programming (OOP concepts, design, algorithm), so I started to learn all of these but I need your opinions and suggestions so I ...
-4
votes
2
answers
180
views
How can I refactor this method in C# with a design pattern? [closed]
I have this method in C# that could be refactored. Should I use a design pattern? I see too much repetition and it gets worse if more conditionals are added.
Should I change it to a method call?
<...
2
votes
0
answers
871
views
Dynamic graph in C++11 with shortest path algorithm
I've been designing a dynamic graph to improve my understanding of C++11. The dynamic aspect means that it could represent the hyperlink structure of a chunk of the internet, with node deletion ...