Please check my answer to a pseudocode CASE statement question

This is a pseudocode question in my IGCSE CompSci textbook:

Use a CASE statement to display the day of the week if the variable DAY has the value 1 to 7 and an error otherwise.

This is my answer to it:

CASE Day OF     1 : OUTPUT "Monday"     2 : OUTPUT "Tuesday"     3 : OUTPUT "Wednesday"     4 : OUTPUT "Thursday"     5 : OUTPUT "Friday"     6 : OUTPUT "Saturday"     7 : OUTPUT "Sunday"     OTHERWISE OUTPUT "Day invalid" ENDCASE 

Is this answer correct?

(I realise this is a very rudimentary question for a Year 10/11 CompSci class but I’m homeschooled with no teaching guidance whatsoever. So a big cheers to anyone who would take the time to check my answer for me.)

Algorithm complexity exercise, please help

For a certain problem two solution algorithms (A1 and A2) with the following execution times have been found:

  • $ A1: T(n)=4n^2 +7log(n^2)$
  • $ A2: T(n) = 4T(n/2) + log(n)$

Say, technically justifying the answer, which of the two algorithms is preferable for input of size sufficiently large

Here my solution

For $ A1$ there is no recursion, the predominant term is $ 4n^2$ so we can say:

Complexity of $ A1 = O(n^2)$

For $ A2$ we do have recursion, Let’s use the Master Theorem:

$ a = 4$ , $ b = 2$ and $ f(n) = log(n)$

$ $ f(n) < n^{\log_{b} a}$ $ $ $ log(n) < n^{\log_{2} 4}$ $ $ $ log(n) < n^2$ $

Case 1:
Complexity of $ A2 = \theta(n^2)$

Here come my question, which one is preferable and why ?

I’d say we have no difference since both algorithms have an upper bound of $ c*n^2$

Can some one please explain what is meant by “5 level lower” with Kineticist Archetype Elemental Purist’s Limited Buffer feature?

Can some one please explain what is meant by “5 levels lower” with Kineticist Archetype Elemental Purist’s Limited Buffer feature?

So far I get that you just get it and it benefits later at level 11. Isn’t it?

Please Fix – Stuck Project/Thread?

@Sven

Was something recently changed with Blog Comment, Image Comment, Pingback or Trackback?

I have projects that only target Blog Comment, Image Comment, Pingback and Trackback. And these are the only projects that are getting stuck. These projects build links but then get stuck and do not proceed. So I manually have to stop and refresh within SER and restart projects. What is also strange is when I restart these projects the Submitted and Verified numbers go backwards by thousands. Another strange thing happens is that when I stop these projects the active thread count still shows example T:35.

Other projects that target all other platforms like Article, Directory, Forums, Social Networks/ Bookmark, Guestbooks, etc. work fine and never get stuck.

This has created a huge problem for me since I have to keep on restarting these projects over and over, please fix.

Netcat on Debian Security advice please nc -(dknl) [closed]

This is with regards to a Netcat based script running on a Debian based distribution, specifically the Proxmox hypervisor (see here if unknown https://en.wikipedia.org/wiki/Proxmox_Virtual_Environment)

I would need to run a script to start a Virtual Machine from a remote PC within the network. The script running on this Proxmox (Debian) distribution is as follows:

**nc -dknl -p 9 -u |**  stdbuf -o0 xxd -c 6 -p | stdbuf -o0 uniq | stdbuf -o0 grep -v 'ffffffffffff' | while read ; do MAC=$  {REPLY:0:2}:$  {REPLY:2:2}:$  {REPLY:4:2}:$  {REPLY:6:2}:$  {REPLY:8:2}:$  {REPLY:10:2}; echo Received Address: $  MAC if [ "$  MAC" == "0c:d2:92:48:68:9b" ] then echo STARTING VM! qm start 101   # Proxmox Command to start Virtual machine. fi done 

Could the Debian running above script be exploited, as Netcat listens on Port 9 UDP (it could of course listen to another port as well if I change that)? Naturally, anyone in the network could start a VM, but is there another risk?

Can Someone please explain what is happening in recursive nature of this algorithm

I’ve implemented a program to print all possible outcomes of N dice rolls

Like:

import java.util.*;  public class RollNDice {     private static int calls = 0;     private static int base = 0;     public static void main(String[] args) {         int n = 2;         rollNDices(n);     }      private static void rollNDices(int N)     {         List<Integer> chosen = new ArrayList<>();         rollNDiceHelper(N, chosen, 1);         System.out.println("Total Calls: "+calls+" Base Hit: "+base);     }      private static void rollNDiceHelper(int dices, List<Integer> chosen, int index)     {         calls++;         //System.out.println("rollNDiceHelper("+dices+", "+chosen+")");         if(0 == dices)         {             base++;             System.out.println(chosen);         }         else         {             for(int i = 1; i <= 6; i++)             {                 chosen.add(i);                 rollNDiceHelper(dices - 1,chosen,i);                 chosen.remove(chosen.size() - 1);             }         }     } } 

Which works fine and prints all the possible outcomes with The Analysis line: Total Calls: 43 Base Hit: 36

Which makes sense because for N dice there will be 6 ^ N possible outcomes.

However,

When I change it slightly like:

private static void rollNDiceHelper(int dices, List<Integer> chosen, int index)     {         calls++;         //System.out.println("rollNDiceHelper("+dices+", "+chosen+")");         if(0 == dices)         {             base++;             System.out.println(chosen);         }         else         {             for(int i = index; i <= 6; i++)             {                 chosen.add(i);                 rollNDiceHelper(dices - 1,chosen,i);                 chosen.remove(chosen.size() - 1);             }         }     } 

Everything starts to Change strangely..

Now not even possible outcomes are printed but the Analysis line is also: Total Calls: 28 Base Hit: 21

I know we don’t need to use index for this specific task here But I wanted to know what will happe if we use it?

Can someone please help me in understanding what is happening here? Where Can we use index (As It reduces calls dramatically)? What will be best example to carfy both the cases (use of index parameter and no use of it). Also What will be the complexity in other case?

Please advice I am looking for the best tanning lotion that can work on my skin.

I have been a regular user of different kinds of lotions that I have been advised to use by my workmates. At first, the lotion that I was recommended to seemed to be working for a few days. After a week of applying the tanning lotion, I got scars like burns. I went back to my friends and asked them what was going on; they told me it will be fine in a few days. It has been two months now and nothing seem to change, Am worried please help me and recommend the tanning lotion that can help me out.