Questions tagged [computer-science]

Computer science (CS) is the science behind programming. Use for questions related to the more theoretical questions involving programming. Questions of a purely theoretical nature may be off-topic. All CS questions can be asked on https://cs.stackexchange.com/

Computer science (also called computing science, and often abbreviated CS) is the study of the theoretical foundations of information and computation and of practical techniques for their implementation and application in computer systems. Computer scientists invent algorithmic processes that create, describe, and transform information and formulate suitable abstractions to model complex systems.

As a discipline, computer science spans a range of topics from theoretical studies of algorithms and the limits of computation to the practical issues of implementing computing systems in hardware and software.

While some computer science questions are on-topic for Stack Overflow, many of the more theoretical questions or questions that do not apply to programming are off-topic. You can ask these types of questions on the Computer Science Stack Exchange.

4449 questions
1
vote
0 answers

What is the formula of CC or average CPI?

I have a MIPS code. There are 189 instructions and 55 of them are memory instructions. There are some values that are given, Data cache miss rate = 20% Miss penalty = 100 Clock Cycles. And the question is to calculate total CC for code and average…
1
vote
1 answer

Why does my program not print txt file inputs?

Here is the output that I am getting: This code is supposed to read the text file and print all instances where the CPM is with 5 measurements of the Top CPM. The code uses a separate class to format (.getDateTime & .getCountsPerMinute) For some…
wvvvy
  • 11
  • 3
1
vote
1 answer

How to input user images to predict with Tensorflow?

For my project, I am using tensorflow to predict handwritten user input. Basically I used this dataset: https://www.kaggle.com/rishianand/devanagari-character-set, and created a model. I used matplotlib to see the images that were being produced by…
1
vote
2 answers

prevent duplicate (Unique Passport)

I'm trying to prevent user to add 2 attendee with the same passport I tried many things as making Boolean variable to check if attendee was added before or no but I have failed all of my attempts can't really think of a way to make this public class…
user16096885
1
vote
1 answer

Push Down Automata Using Fixed States

I've been asked to find the PDA for the language L over the alphabet {a,b,c,d} where L={(a^p)(b^2p)(c^r)(d^s)| p,r,s > 0 AND r=s} I have solved it using 5 states but I must solve it using 6 states. Could anyone help me solve it? [1]:…
1
vote
1 answer

Confusion about Hash Map vs Trie time complexity

Let's say we're comparing the time complexity of search function in hashmap vs trie. On a lot of resources I can find, the time complexities are described as Hashmap get: O(1) vs Trie search: O(k) where k is the length of chars in the string you…
EdH
  • 75
  • 1
  • 5
1
vote
1 answer

Two sets which have the Kleene star implies one set is a subset of another

Say that: A={a,b} and B is equal to or a subset of {a,b}* then A*=B* implies A is equal to or a subset of B. I have a hard time with this since B equal to or subset of {a,b}* means that we don't really know what B contains. A* = B* makes sense as I…
1
vote
1 answer

Voyager golden record binary arithmetic

I just read the article about the Voyager gold record cover,however, I do not understand the binary arithmetic of the left-hand corner, As you can see from the image below,, can some one please explain this binary arithmetic for me comprehensively?…
Cn Hu
  • 57
  • 6
1
vote
1 answer

How to order this graph?

I need to order a graph appropriately, considering the levels. Assuming I have this data: const people = [ { 'name': 'john', 'level': 0, 'connections': ['monica', 'jeffrey'] }, { 'name': 'monica', …
1
vote
2 answers

Array of pointers

I am trying to construct an m-way tree and I am having trouble visualizing an array of pointers pointing to different instances of the B_tree node class (this basically creates the array type nodes and includes all functions associated with the tree…
rrazd
  • 1,741
  • 2
  • 32
  • 47
1
vote
1 answer

COUNT function not counting correctly with DATEDIFF

I am sure this is a simple fix, but can not figure it out. I have a COUNT function that needs to count the total number of Rentals. Alone, the function works just fine. I have tried using DISTINCT, tweaking the GROUP BY, and ORDER BY, but to not…
1
vote
2 answers

How can I find a word in a string of characters where the characters may be separated by whitespaces

Basically what the program needs to do is input a word and a string of characters and find that word in the string where that word can be separated by whitespaces. For example: Input string: "this is a c a m e l" Word to find: camel In this case,…
Bubbelz
  • 11
  • 4
1
vote
4 answers

Find round routes in a list of tuples

I have a list of tuples containing sources and destinations I need to make sure there are no "round routes" For example: [(1,2), (3,4), (2,3)]. is OK but [(1,2), (3,4), (2,3), (3,1)]. It is not OK as we can go from 1 → 2 → 3 → 1 I got nostalgic…
Ido Barash
  • 4,856
  • 11
  • 41
  • 78
1
vote
1 answer

I am trying to do a function calculation in python and every time I run the module I get an error message that says "name 'sales bonus is not defined

#End of Year Bonus Calculation WITH FUNCTION #modify the computer program provided so that the calculation of the bonus is done by a function whose input data (its parameters)are the employee’s total sales for the year and the employee’s years of…
Jeffrey23
  • 11
  • 1
1
vote
1 answer

Time complexity to insert a node before the node pointed by some pointer in circular singly list of n nodes?

I think that it is O(N) because in a circular singly list the pointer visits n nodes so that node to be inserted precedes the current node. Have I got it right?
1 2 3
99
100