# 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/

3,992
questions

**0**

votes

**0**answers

8 views

### I need help trouble shooting a syntax error

I'm running "wpdistillery/config.yml" and getting the error message "zsh: permission denied"

**-1**

votes

**0**answers

6 views

### Creates the initial grid of sequence by taking the initialsequence and taking the difference iteratively untilitreaches sequence where all the numbers

@param sequence Seed sequence that dictates the other sequences
* @return A list of sequences where each subsequent sequence is the difference of the previous one
*/
private static List initializeGrid(...

**-2**

votes

**0**answers

10 views

### Assignment for Gate level minimization (K-map)

Assignment for Gate level minimization (K-map)
a) Simplify the following Boolean expression using three variable maps
F(x, y, z) = x y z + x’y’ z + x y’ z’
b)Simplify the following Boolean ...

**-2**

votes

**0**answers

16 views

### How to properly include and read a header file in Visual Studio Code for MacBook Pro [duplicate]

I'm working on a project. This is the error I receive when trying to run:
tempCodeRunnerFile.cpp:2:10: fatal error: 'Poly.h' file not found
#include "Poly.h"
^~~~~~~~
1 error generated.
I ...

**-3**

votes

**0**answers

43 views

### How many hexagons fit in a rectangular?

I must create an algorithm. This algorithm's issue is "find the maximum number of pentagons, hexagons and heptagons with side length M cm can fit into a rectangle with a short side K and a long ...

**-1**

votes

**1**answer

18 views

### CS50/Substitution why tolower() function doesn't work in my code

Can someone explain if I switch // 3.3 Must not contained repeated letters |
if (toupper(argv[1][j] == toupper(argv[1][k]))) to -> if (tolower(argv[1][j] == tolower(argv[1][k]))) why it doesn't ...

**-1**

votes

**1**answer

19 views

### Is L = {a^n a^n b^m |m, n ≥ 0} a regular or irregular language?

I have troubles in solving/proving this problem. I can understand that in a non regular no Finite State Automaton/Machine can be written that validates and accepts this input since it lacks a memory ...

**-2**

votes

**0**answers

15 views

### Boolean logic explanation of the ALU [closed]

How could you use your ALU to compute a bitwise Xor function of two 8-bit numbers?
Would you expect your ALU to run faster, i.e. take less time for its output to stabilise at
a true or false value, ...

**0**

votes

**0**answers

9 views

### What does GigaOPs refer to in data processing? [closed]

I recently read a sentence in this paper about the graph neural networks that:
A 2-layer Graph Convolutional Network (GCN) model with 32 hidden units would result in a model size of just 81KB but ...

**-2**

votes

**1**answer

31 views

### How do computers store floating point numbers.?

For positive numbers, the binary can be found out easily. For negative number it is the 2's complement of the positive number. I have a doubt how the computer store or understand the floating point ...

**0**

votes

**1**answer

33 views

### Return input information in android Studio Java

I am new to android studio and I am trying to play with simple program that takes an input from the user such as name, certification number, and role and display the user input as an output. I am ...

**-3**

votes

**0**answers

32 views

### Hacked and Terrorized [closed]

There is a group that has hacked all of my devices and have not let go since October 2020. Their goal has been to terrorize me and play sick games. They have broken into my home. Does anyone know of ...

**0**

votes

**1**answer

46 views

### General Idea Of Component System. Too much casting? Union like structs? other methods?

I've been investigating the idea of a component based system. Imagine I have made them like so :
public class CObject
{
public Component[] components;
public T GetComponent<T>(string ...

**-3**

votes

**0**answers

16 views

### How can I find a node with a specific position, then display its data? [closed]

this is a data structure problem. help me with the full code. i need to solve this. I tried this below...
#include <stdio.h>
#include <stdlib.h>
struct node{
int data;
struct node ...

**0**

votes

**1**answer

26 views

### Calculate in android studio Java

I have created several EditTexts that a user can enter numbers and I would like to get and show the output in the last Edittext called math_test2.Can you guys help me with the syntax? Iam new to ...

**-3**

votes

**0**answers

12 views

### What type of system calculates probabilities based on multiple rules? [closed]

I have a system that takes in some data, this data is run through multiple rules that calculate three values based on that data e.g. (0.2,0.6,0.4).
Then these results are combined into three final ...

**1**

vote

**1**answer

29 views

### Is there an algorithm to compute if a calculation will overflow a type size?

Is there an algorithm which can be applied to most languages to determine if a calculation when preformed will overflow the type size?
As an example if given the following code fragment in Java (...

**-1**

votes

**0**answers

22 views

### Why are signed and unsigned integers an important concept to know in CS? [closed]

Many times I'll come across problem sets in CS books or LeetCodes and it will be somehow related to signed or unsigned 32-bit integers. My understanding it is basically like how many one's and zero's ...

**1**

vote

**1**answer

43 views

### How to find a point within a square in racket?

Currently, I am struggling with figuring out a function that can determine if a point is in a square or not given the side length and top left corner of the square.
; tl is a Posn, giving the top-left ...

**2**

votes

**0**answers

16 views

### steganography image im image by using k-mean [closed]

When I hide an image within a picture using the ( k-mean clustering) technique, I have a problem when scaling ( entropy major ) appears. I have the measurement ( 5.6) even though the size of the ...

**0**

votes

**1**answer

20 views

### What is a dataframe from programming point of view?

Several data-science packages, e.g. Python's Pandas, have a "dataframe" around which all other functionality are based. What exactly is a dataframe from programming point of view?

**0**

votes

**2**answers

46 views

### >: expects a real, given (void)

I am currently struggling with creating a list that finds if all the numbers within the list are equal to each other:
(define (list-all-equal lon) (cond [(empty? lon) lon]
...

**-2**

votes

**0**answers

64 views

### Is there any efficient approach?(Finding the number of ocuurence is even of all elements within given range) [closed]

This code makes a subarray out of given vector and checks whether all elements
are appeared even number of times in the subarray we are taking range as an input to create new subarray
#include <...

**0**

votes

**0**answers

72 views

### Longest Common Subsequence with Restricted Number of Substring Parts

Recently I am learning Dynamic Programming (DP) and this video shows building up the DP table to get the Longest Common Subsequence (lcs).
What would this table be if there is another parameter m that ...

**0**

votes

**2**answers

32 views

### Nine's complement with positive and negative decimal values Question

"If the number is positive, the nine's complement of the number is itself."
I read this on a book named "Foundation of Computer Science", it said that the 9's complement of +234 is ...

**0**

votes

**2**answers

44 views

### Accessing texts files in Java

I am trying to access text files in Java, however, I don't know how to do to that and apply it to a 2D array. I have done it before for a String in a pig latin coding assignminet
e.x :
public ...

**-2**

votes

**0**answers

5 views

### Is static testing is part of dynamic?

The static testing is done by without execution of the code.. And when we run the code and find the error we are not able to kick of the error on same line then we need to study the full code or ...

**-1**

votes

**1**answer

21 views

### How to write the Ternary Search alogrithm?

Algorithm that searches a sorted
list of n items by dividing it into three sublists of almost n/3 items. This algorithm finds the
sublist that might contain the given item and divides it into three ...

**0**

votes

**0**answers

35 views

### C# Console.ReadLine creates new line with every keypress

I've encountered this weird issue that might be connected to my IDE or C# overrall.
Whenever I am inputting something in the console that is being read my Console.ReadLine(), it is being duplicated ...

**0**

votes

**0**answers

22 views

### How do I convert EBNF to BNF in this example?

I studied how to convert EBNF to BNF on the Internet, but I am having a hard time converting that example.
(1) I need to convert this phrase to BNF.
<SUB> ::= <A> <B> ‘(’ [ <C> ...

**0**

votes

**1**answer

97 views

### How to understand the purpose of this function ？

bool isEqualOrBiggerUint32(uint32_t src, uint32_t dest)
{
return (src - dest < 0x7fffffff);
}
I think this function is compare dest and src.
But, why we should use 0x7fffffff in this function ?...

**0**

votes

**0**answers

18 views

### The practical importance of Graph Isomorphism Problem

It is known that Graph Isomorphism is important in chemistry (studying molecule structures) and in chip design. Are there other applications of significant practical importance, and how much money is ...

**2**

votes

**1**answer

27 views

### What other logic gates can be added to the set {XOR} to form a universal set?

I am having problem with the following question:
The set {XOR} is not a complete set, that is, XOR is not a universal gate. Add another logic gate into the set to make the new set a complete set, and ...

**0**

votes

**0**answers

26 views

### Binary Subtraction using logic gates

I've been trying to recreate a binary full subtractor from a logic circuit diagram, but I can't seem to get a output that is accurate. I've rewritten it a few ways and ran it without a loop and ...

**0**

votes

**1**answer

31 views

### 8085 microprocessor connection of CPU data bus with RAM data bus

What would happen if the CPU data-bus bit 2 is connected to the RAM data-bit 5 and CPU data-bus bit 5 is connected to RAM data bit 2? Assume the rest of the connections are all right – explain.
My ...

**-1**

votes

**1**answer

17 views

### Is an empty clause within another empty clause is equivalent to an empty clause ?(In CNF form)

Is the clause { { } } ≡ { } ? The clauses are In CNF form.I tried thinking about it , so the final solution, according to me should be that the statement is true. Is the understanding correct?

**-1**

votes

**0**answers

73 views

### Achieve virtualization without trap instructions

The OS uses the trap instruction and interrupts with hardware support to enable the virtualization of CPU. Now suppose the hardware does not support the trap instruction, but does support interrupts ...

**-1**

votes

**0**answers

19 views

### What is the most optimized algorithm to randomly shuffle a stack?

given a stack (NOT AN ARRAY) with N elements, what is the most efficient algorithm to shuffle the stack randomly? i.e. given a stack of N songs like in Spotify, what is the best way to shuffle them?

**0**

votes

**0**answers

22 views

### Construct 4*32k memory using 4*8k memory units

This question is regarding a concept in Computer Architecture - "Memory expansion".
if anyone could attach a drawing with a description, it would be really helpful.
Thank you very much!

**2**

votes

**1**answer

23 views

### Time Complexity loop inside a loop with increased starting index

I know the main concepts of time complexity questions but I always fall on these tricky ones, can someone please explain the thought process on why the answer is this one.
Also in this case the first ...

**-1**

votes

**0**answers

22 views

### Turing machine halting problem-Finding such turing machine or prove its nonexistence

I am working on computability and logic this semester, with knowing computer science theory less before. I have a problem when I am doing my homework, that is：
Is there a Turing machine that, started ...

**0**

votes

**0**answers

29 views

### I'm trying to make a caesar cipher decryption but I keep getting: ord() expected a character, but string of length 10 found

shift = 3
encrypted_text = open("book.txt", "r", encoding="utf-8")
plain_text = ""
for c in encrypted_text:
if c.isupper():
c_unicode = ord(...

**2**

votes

**1**answer

49 views

### What is the maximum total number of instructions?

I was given three types of instruction, Type A, B, C which has 4, 7, 8-bit opcode respectively. What is the maximum total number of instructions if all three types of instructions exist? The answer ...

**2**

votes

**1**answer

33 views

**1**

vote

**1**answer

49 views

### Total Time Complexity of Nested Big-O's

I wrote a program to calculate the factorial of a number, and store the digits of the result in a Python list.
To find the factorial, I run a loop that takes O(N) and store the result in "ans&...

**1**

vote

**1**answer

49 views

### Parsing loops in a javascript interpreter

I've been exploring writing a very basic / limited interpreter in javascript as an exercise. All has been going well until I introduced the concept of LOOPs.
Given the following script:
LOOP 2
A
...

**0**

votes

**3**answers

73 views

### Best time complexity of a single loop?

I have a really simple question, I have this loop:
for (int i=0; i<n; i++) {
"some O(n) stuff here)"
}
what will be the BEST time complexity of this algorithm?
O(n)? (for loop O(1) * ...

**1**

vote

**1**answer

21 views

### Finding maximum number of register counts from instruction size, op-code size, and number of operands

I've been trying to wrap my head around how to achieve the answer. I'd like to say I did my own research but either I'm not searching the right questions or I'm blind. Can someone please explain the ...

**0**

votes

**2**answers

59 views

### How do you get rid of Hz when calculating MIPS?

I'm learning computer structure.
I have a question about MIPS, one of the ways to calculate CPU execution time.
The MIPS formula is as follows.
And if the clock rate is 4 GHz and the CPI is 1.
I ...

**-2**

votes

**1**answer

25 views

### Virtual Machines vs Containers

Good day to all,
I am currently a student studying computer science and came across the topic on Virtual Machines vs Containers. I have also spent the last 3-4 hours trying to understand Containers. I ...