CS61A 2022 fall lab01

news2025/1/16 14:54:28

CS61A 2022 fall lab01

文章目录

  • CS61A 2022 fall lab01
  • Topics
    • Division, Floor Div, and Modulo
    • Functions
      • Call expressions
      • `return` and `print`
    • Control
      • Boolean operators
        • Shorting Circuiting(短路效应)
      • If Statements
      • While Loops
    • Error Messages
  • Required Questions
    • What Would Python Display? (WWPD)
      • Q2: WWPD: Control
      • Q3: WWPD: Veritasiness
      • Q4: Debugging Quiz
    • Code Writing Questions
      • Q5: Falling Factorial
      • Q6: Sum Digits
  • Extra Practice
    • Q7: WWPD: What If?
    • Q8: Double Eights
  • [查漏补缺] Basic Knowledge and skills
    • 复习一下scp命令,把lab1的文件传到Linux上面去
    • 复习一下Linux上的解压命令
    • 基础的排列组合公式
    • 复习一下python的`in`

Topics

Division, Floor Div, and Modulo

  • True Division: / (decimal division)
  • Floor Division://(integer division)

之前在Homework01里面体会了floor division 和 true division的区别

  • Modulo**😗* %(remainder)

  • 这三个如果右边的operand为0的话,都会抛出 ZeroDivsionError 的错误

Functions

If we want to execute a series of statements over and over, we can abstract them away into a function to avoid repeating code.

Call expressions

A call expression applies a function, which may or may not accept arguments. The call expression evaluates to the function’s return value.↳

The syntax of a function call:

  add   (    2   ,    3   )
   |         |        |
operator  operand  operand

Every call expression requires a set of parentheses delimiting its comma-separated operands.

  • To evaluate a function call:
    • Evaluate the operator, and then the operands (from left to right).
    • Apply the operator to the operands (the values of the operands).

If an operand is a nested call expression, then these two steps are applied to that inner operand first in order to evaluate the outer operand.

return and print

  • return

    • The return statement will give the result of some computation back to the caller of the function and exit the function.
    • When Python executes a return statement, the function terminates immediately. If Python reaches the end of the function body without executing a return statement, it will automatically return None.
  • print

    • the print function is used to display values in the Terminal. This can lead to some confusion between print and return because calling a function in the Python interpreter will print out the function’s return value.
  • Notice

    def what_prints():
        print('Hello World!')
        return 'Exiting this function.'
        print('61A is awesome!')
    
    >>> what_prints()
    Hello World!
    'Exiting this function.'
    

    Notice also that print will display text without the quotes, but return will preserve the quotes.

Control

Boolean operators

  • Python supports three boolean operators: and, or, and not

  • The order of operation

    • not has the highest priority
    • and
    • or has the lowest priority
  • Truthy and Falsey Values: It turns out and and or work on more than just booleans (True, False).

    • Python values such as 0, None, '' (the empty string), and [] (the empty list) are considered false values.
    • All other values are considered true values.

Shorting Circuiting(短路效应)

  • True or 1 / 0 这个表达式不会抛出 Zero DivisionError

    OperatorChecks if:Evaluates from left to right up to:Example
    ANDAll values are trueThe first false valueFalse and 1 / 0 evaluates to False
    ORAt least one value is trueThe first true valueTrue or 1 / 0 evaluates to True

    Short-circuiting happens when the operator reaches an operand that allows them to make a conclusion about the expression. For example, and will short-circuit as soon as it reaches the first false value because it then knows that not all the values are true.

    If and and or do not short-circuit, they just return the last value; another way to remember this is that and and or always return the last thing they evaluate, whether they short circuit or not. Keep in mind that and and or don’t always return booleans when using values other than True and False.

If Statements

Tip: We sometimes see code that looks like this:

if x > 3: 
    return True 
else: 
    return False 

This can be written more concisely as return x > 3. If your code looks like the code above, see if you can rewrite it more clearly!

While Loops

Error Messages

  • 一些常见的error

    Error TypesDescriptions
    SyntaxErrorContained improper syntax (e.g. missing a colon after an if statement or forgetting to close parentheses/quotes)
    IndentationErrorContained improper indentation (e.g. inconsistent indentation of a function body)
    TypeErrorAttempted operation on incompatible types (e.g. trying to add a function and a number) or called function with the wrong number of arguments
    ZeroDivisionErrorAttempted division by zero
  • orz,手把手教如何看error👇

    image-20230125011516937

Required Questions

What Would Python Display? (WWPD)

终端里面输入python3 ok -q control -u

image-20230125012129455

Q2: WWPD: Control

  • 题目质量真不错

    我这里试了好几次才反应过来,这个知识点在topic里面提到了:

    Notice also that print will display text without the quotes, but return will preserve the quotes.

    image-20230125012104907
  • 还有几个,感觉都是有一些小trick在里面

    image-20230125012557290

    这个考察的知识点是那个

    • Python values such as 0, None, '' (the empty string), and [] (the empty list) are considered false values.
    • All other values are considered true values.
  • 呜呜呜要是我在UCB就好了,每次到这里的时候都只能眼巴巴

    image-20230125012753334

Q3: WWPD: Veritasiness

  • 这几个我不太熟

    比如那个True and 13 返回的是13,这个原理是

    In Python, the and operator returns the first operand if it is evaluated as False, otherwise it returns the second operand. Since the first operand, True, is evaluated as True, the second operand, 13, is returned. So in this case, True and 13 evaluates to 13.

    还有那个False or 0

    In Python, the or operator returns the first operand that is considered “truthy” (i.e. evaluates to True when used in a boolean context). Since False is considered “falsy” and 0 is considered “falsy” as well, False or 0 will return 0.

    What would Python display? If you get stuck, try it out in the Python
    interpreter!
    
    >>> True and 13
    ? True
    -- Not quite. Try again! --
    
    ? 13
    -- OK! --
    
    >>> False or 0
    ? 0
    -- OK! --
    
    >>> not 10
    ? False
    -- OK! --
    
    >>> not None
    ? True
    -- OK! --
    
    ---------------------------------------------------------------------
    
  • 前面topic里面总结的挺好👇

    If and and or do not short-circuit, they just return the last value; another way to remember this is that and and or always return the last thing they evaluate, whether they short circuit or not.

    Keep in mind that and and or don’t always return booleans when using values other than True and False.

    用这个规则来做,真的很爽, 比如略微复杂的下面这组

    ---------------------------------------------------------------------
    Veritasiness > Suite 1 > Case 2
    (cases remaining: 2)
    
    What would Python display? If you get stuck, try it out in the Python
    interpreter!
    
    >>> True and 1 / 0 and False  # If this errors, just type Error.
    ? Error
    -- OK! --
    
    >>> True or 1 / 0 or False  # If this errors, just type Error.
    ? True
    -- OK! --
    
    >>> True and 0  # If this errors, just type Error.
    ? 0
    -- OK! --
    
    >>> False or 1  # If this errors, just type Error.
    ? 1
    -- OK! --
    
    >>> 1 and 3 and 6 and 10 and 15  # If this errors, just type Error.
    ? 15
    -- OK! --
    
    >>> -1 and 1 > 0 # If this errors, just type Error.
    ? True
    -- OK! --
    
    >>> 0 or False or 2 or 1 / 0  # If this errors, just type Error.
    ? 2
    -- OK! --
    
    ---------------------------------------------------------------------
    Veritasiness > Suite 2 > Case 1
    
  • 下面这组也不错

    ---------------------------------------------------------------------
    Veritasiness > Suite 2 > Case 1
    (cases remaining: 1)
    
    What would Python display? If you get stuck, try it out in the Python
    interpreter!
    
    >>> not 0
    ? True
    -- OK! --
    
    >>> (1 + 1) and 1  # If this errors, just type Error. If this is blank, just type Nothing.
    ? 1
    -- OK! --
    
    >>> 1/0 or True  # If this errors, just type Error. If this is blank, just type Nothing.
    ? Error
    -- OK! --
    
    >>> (True or False) and False  # If this errors, just type Error. If this is blank, just type Nothing.
    ? False
    -- OK! --
    
    ---------------------------------------------------------------------
    

Q4: Debugging Quiz

  • 呜呜,教debug!

    
    In the following traceback, what is the most recent function call?
    Traceback (most recent call last):
        File "temp.py", line 10, in <module>
        f("hi")
        File "temp.py", line 2, in f
        return g(x + x, x)
        File "temp.py", line 5, in g
        return h(x + y * 5)
        File "temp.py", line 8, in h
        return x + 0
    TypeError: must be str, not int
    
        0) g(x + x, x)
        1) h(x + y * 5)
        2) f("hi")1 
    
  • 这个也是知识漏洞

    Q: How do you write a doctest asserting that square(2) == 4?
    Choose the number of the correct choice:
    0) def square(x):
           '''
           square(2)
           4
           '''
           return x * x
    1) def square(x):
           '''
           input: 2
           output: 4
           '''
           return x * x
    2) def square(x):
           '''
           >>> square(2)
           4
           '''
           return x * x
    3) def square(x):
           '''
           doctest: (2, 4)
           '''
           return x * x
    ? 选2
    
  • 知识漏洞+1

    Q: When should you use print statements?
    Choose the number of the correct choice:
    0) To investigate the values of variables at certain points in your code
    1) For permanant debugging so you can have long term confidence in your code
    2) To ensure that certain conditions are true at certain points in your code
    ? 选0
    -- OK! --
    
  • 还问了ok autograder相关的

    其实下面这个没太明白👇

    Q: How do you prevent the ok autograder from interpreting print statements as output?
    Choose the number of the correct choice:
    0) You don't need to do anything, ok only looks at returned values, not printed values
    1) Print with # at the front of the outputted line
    2) Print with 'DEBUG:' at the front of the outputted line
    ? 2
    -- OK! --
    

    soga,其实lab上方有写

    在这里插入图片描述

    Q: What is the best way to open an interactive terminal to investigate a failing test for question sum_digits in assignment lab01?
    Choose the number of the correct choice:
    0) python3 ok -q sum_digits --trace
    1) python3 -i lab01.py
    2) python3 ok -q sum_digits -i
    3) python3 ok -q sum_digits
    ? 选2,题目里面说了interactive
    

    orz,还有个专门的 ok help 网站…

    下面这个猜对的

    Q: What is the best way to look at an environment diagram to investigate a failing test for question sum_digits in assignment lab01?
    Choose the number of the correct choice:
    0) python3 ok -q sum_digits
    1) python3 ok -q sum_digits --trace
    2) python3 ok -q sum_digits -i
    3) python3 -i lab01.py
    ? 1
    -- OK! --
    
  • 编程习惯和相关的也有

    Q: Which of the following is NOT true?
    Choose the number of the correct choice:
    0) It is generally bad practice to release code with debugging print statements left in
    1) It is generally good practice to release code with assertion statements left in
    2) Code that returns a wrong answer instead of crashing is generally better as it at least works fine
    3) Testing is very important to ensure robust code
    4) Debugging is not a substitute for testing
    ? 2
    -- OK! --
    

这个本地自动测评,如果中途断了,下次也会自动续上,它是通过Py文件里面的一个布尔变量locked来控制的

Code Writing Questions

Q5: Falling Factorial

Let’s write a function falling, which is a “falling” factorial that takes two arguments, n and k, and returns the product of k consecutive numbers, starting from n and working downwards. When k is 0, the function should return 1.

def falling(n, k):
    """Compute the falling factorial of n to depth k.

    >>> falling(6, 3)  # 6 * 5 * 4
    120
    >>> falling(4, 3)  # 4 * 3 * 2
    24
    >>> falling(4, 1)  # 4
    4
    >>> falling(4, 0)
    1
    """
    "*** YOUR CODE HERE ***"

这个有点像组合问题的基本公式约分后,分母上剩下的东西

  • 我一开始的solution

    def falling(n, k):
        """Compute the falling factorial of n to depth k.
    
        >>> falling(6, 3)  # 6 * 5 * 4
        120
        >>> falling(4, 3)  # 4 * 3 * 2
        24
        >>> falling(4, 1)  # 4
        4
        >>> falling(4, 0)
        1
        """
        "*** YOUR CODE HERE ***"
        if k == 0:
            return 1
        else:
            res = 1
            for i in range(k):
                res *= n
                n = n - 1
            return res
    
  • copilot的solution,妥妥orz

    def falling(n, k):
        """Compute the falling factorial of n to depth k.
    
        >>> falling(6, 3)  # 6 * 5 * 4
        120
        >>> falling(4, 3)  # 4 * 3 * 2
        24
        >>> falling(4, 1)  # 4
        4
        >>> falling(4, 0)
        1
        """
        "*** YOUR CODE HERE ***"
        if k == 0:
            return 1
        else:
            return n * falling(n-1, k-1)
    

    这个方法非常妙,k每次减一减到0,刚好需要k次,那么n也就是乘了k次,而且n也是每次减一

  • 官方给的solution,使用了多重赋值表达式

    total, stop = 1, n-k
    while n > stop:
        total, n = total*n, n-1
    return total
    

    发现官方solution经常是反过来考虑的哈哈哈,之前那个hw01里面找一个数的最大因数,是反着来的,这里它也是直接找到了stop的条件

Q6: Sum Digits

Write a function that takes in a nonnegative integer and sums its digits. (Using floor division and modulo might be helpful here!)

def sum_digits(y):    
    """Sum all the digits of y.     
    >>> sum_digits(10) # 1 + 0 = 1    1    
    >>> sum_digits(4224) # 4 + 2 + 2 + 4 = 12    12    
    >>> sum_digits(1234567890)    45    
    >>> a = sum_digits(123) # make sure that you are using return rather than print    	     >>> a    6    """    
    "*** YOUR CODE HERE ***" 
    
  • 一开始脑子里的两个想法

    • 逐位取数字,可以用递归或者循环?
    • 先转为字符串,通过split()放入一个list,然后把list里面的字符全都转换为int型,然后循环相加
    • 我觉得第二种挺好
      • 嘶,哦不,split()是按照中间的空格作为分割条件
      • 那么通过循环吧?
  • 于是我就用了第二种,先调试调试

    image-20230125112414590
    • AC咯

      def sum_digits(y):
          """Sum all the digits of y.
      
          >>> sum_digits(10) # 1 + 0 = 1
          1
          >>> sum_digits(4224) # 4 + 2 + 2 + 4 = 12
          12
          >>> sum_digits(1234567890)
          45
          >>> a = sum_digits(123) # make sure that you are using return rather than print
          >>> a
          6
          """
          "*** YOUR CODE HERE ***"
          str_y = str(y)
          strlis = []
          for char in str_y:
              strlis.append(char)
          numlis = [int(c) for c in strlis]
          # print(strlis)
          # print(numlis)
          sum = 0
          for i in numlis:
              sum += i
          return sum
      

      但是,这里用到列表属实是麻烦了…

      我给copilot写了个prompt,看看它用这种方法会怎么做,我感觉属实是被AI薄纱了😭

          # write here,using loop but not recursion
          # fisrt convert into string , then use for loop to sum
          # then convert back to int
          y = str(y)
          sum = 0
          for i in y:
              sum += int(i)
          return sum
      
    • 想想递归怎么做呢

          if y < 10:
              return y
          else:
              return y % 10 + sum_digits(y // 10)
      

      除了base case的控制表达式,不一定是 n == 1那种,也可以是 y < 10 这种

      最后是达到base case再反弹

      所以每个之间需要变化和连接

      变化就是不断接近base case

      y // 10 就是每次不断接近base case

      y % 10 + 就是和递归的前后项的连接之桥

    • 用循环loop,不用recursion怎么写呢

          sum = 0
          while y > 0:
              sum += y % 10
              y = y // 10
          return sum
      

      注意python里面的地板除 floor division

Extra Practice

These questions are optional and will not affect your score on this assignment. However, they are great practice for future assignments, projects, and exams. Attempting these questions can be valuable in helping cement your knowledge of course concepts.

Q7: WWPD: What If?

Use Ok to test your knowledge with the following “What Would Python Display?” questions:

python3 ok -q if-statements -u✂️

Hint: print (unlike return) does not cause the function to exit.

>>> def ab(c, d):
...     if c > 5:
...         print(c)
...     elif c > 7:
...         print(d)
...     print('foo')
>>> ab(10, 20)
(line 1)? 10
(line 2)? foo
-- OK! --

这里有个小trick, 这个有点好玩,c如果小于等于5,也不会进入elif那个分支

这些练习真的对夯实基础很有用啊啊啊啊啊!


What would Python display? If you get stuck, try it out in the Python
interpreter!

>>> def bake(cake, make):
...    if cake == 0:
...        cake = cake + 1
...        print(cake)
...    if cake == 1:
...        print(make)
...    else:
...        return cake
...    return make
>>> bake(0, 29)
(line 1)? 1
(line 2)? 29
(line 3)? 29
-- OK! --

>>> bake(1, "mashed potatoes")
(line 1)? mashed potatoes
(line 2)? "mashed potatoes"
-- OK! --

Q8: Double Eights

Write a function that takes in a number and determines if the digits contain two adjacent 8s.

def double_eights(n): 
    """Return true if n has two eights in a row. 
    >>> double_eights(8) False 
    >>> double_eights(88) True 
    >>> double_eights(2882) True 
    >>> double_eights(880088) True 
    >>> double_eights(12345) False 
    >>> double_eights(80808080) False 
    """ 
    "*** YOUR CODE HERE ***"

Use Ok to test your code:

python3 ok -q double_eights

题目大意就是看看有没有相邻的两个8

我的思路是先转为字符串,然后用循环,每次取两个数字的切片,放入一个列表,然后用in判断"88"在不在字符串里面,解决咯,感觉最近programing 比以前强多了

def double_eights(n):
    """Return true if n has two eights in a row.
    >>> double_eights(8)
    False
    >>> double_eights(88)
    True
    >>> double_eights(2882)
    True
    >>> double_eights(880088)
    True
    >>> double_eights(12345)
    False
    >>> double_eights(80808080)
    False
    """
    "*** YOUR CODE HERE ***"
    n = str(n)
    strlis = []
    for i in range(0,len(n)-1):
        strlis.append(n[i:i+2])
    # print(strlis)
    if "88" in strlis:
        return True
    else:
        return False

**突然想到前面的topic里面说,**Tip: We sometimes see code that looks like this:

if x > 3: 
    return True 
else: 
    return False 

This can be written more concisely as return x > 3. If your code looks like the code above, see if you can rewrite it more clearly!

那么我这个应该也可以简化代码

   n = str(n)
    strlis = []
    for i in range(0,len(n)-1):
        strlis.append(n[i:i+2])  
    return "88" in strlis

呜呜感觉真的收获很大啊!


再想想别的思路呢,在loop的过程中,我一定要全部遍历完才可以吗?不是的,只要有一个88,也就是碰到第一个88,那么就可以返回true了

所以也可以这样

    n = str(n)
    for i in range(len(n)-1):
        if n[i] == '8' and n[i+1] == '8':
            return True
    return False

官方给的solution,麻烦一点,但是也可以体会那种思想👇

    prev_eight = False
    while n > 0:
        last_digit = n % 10
        if last_digit == 8 and prev_eight:
            return True
        elif last_digit == 8:
            prev_eight = True
        else:
            prev_eight = False
        n = n // 10
    return False
  • The function first initializes the variable prev_eight as False, indicating that the previous digit was not an 8.

  • It then enters a while loop, where it repeatedly checks the last digit of the number (by taking the modulus of 10) and compares it to 8.

  • If the last digit is 8 and the previous digit was also 8 (indicated by prev_eight being True), the function returns True, indicating that there are two consecutive 8s in the number.

  • If the last digit is 8 but the previous digit was not 8, the function sets prev_eight to True, indicating that the next digit should be checked to see if it is also 8.

    这里面需要注意的是这个,这次循环的last_digit到了下一次循环就会变成prev(前一个)

            elif last_digit == 8:
                prev_eight = True
    
  • If the last digit is not 8, the function sets prev_eight to False.

  • The function then removes the last digit from the number by floor dividing by 10.

  • The while loop continues until all digits have been checked.

  • If the while loop completes and the function has not yet returned True, it returns False indicating that there are no two consecutive 8s in the number

[查漏补缺] Basic Knowledge and skills

复习一下scp命令,把lab1的文件传到Linux上面去

scp .\lab01.zip root@IP地址:/root/Desktop/cs61a/lab

复习一下Linux上的解压命令

unzip lab01.zip

基础的排列组合公式

  • The basic formula for combination is: C(n, k) = n! / (k! * (n-k)!) where n is the total number of items and k is the number of items being chosen.

  • The basic formula for permutation is: P(n, k) = n! / (n-k)! where n is the total number of items and k is the number of items being chosen.

  • A few examples of combination and permutation problems:

    • How many ways can you choose 3 books from a shelf of 10 books? This is a combination problem and the solution is:
      C 10 3 = 10 ! 3 ! ( 10 − 3 ) ! = 10 ! 3 ! 7 ! = 120 C_{10}^3 = \frac{10!}{3!(10-3)!} = \frac{10!}{3!7!} = 120 C103=3!(103)!10!=3!7!10!=120

    • In how many ways can you arrange the letters of the word “HELLO”? This is a permutation problem and the solution is: 5! = 5 x 4 x 3 x 2 x 1 = 120

    • In how many ways can you select a committee of 3 people from a group of 8? This is a combination problem and the solution is:
      C 8 3 = 8 ! 3 ! ( 8 − 3 ) ! = 8 ! 3 ! 5 ! = 56 C^3_8 = \frac{8!}{3!(8-3)!} = \frac{8!}{3!5!} = 56 C83=3!(83)!8!=3!5!8!=56

    • How many ways can you seat 5 people in a row of chairs? This is a permutation problem and the solution is: 5! = 5 x 4 x 3 x 2 x 1 = 120

复习一下python的in

  • 在Q8里面我用到了 "88" in strlis

  • How to use the built-in function in in python

    The built-in function in in Python is used to check if a specific element is present in a given sequence (such as a list, tuple, or string). The syntax for using the in keyword is as follows:

    element in sequence
    

    Here, element is the item you want to check for, and sequence is the list, tuple, or string that you want to check within. The function will return True if the element is present in the sequence, and False if it is not.

    Here’s an example of using the in function to check if the number 5 is in a list of numbers:

    numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    print(5 in numbers) # Output: True
    

    Another example, using in to check if “Hello” is present in a string:

    sentence = "Hello World!"
    print("Hello" in sentence) # Output: True
    

    You can also use not in to check if an element is not present in a sequence:

    numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    print(11 not in numbers) # Output: True
    

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/178384.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

AI算法(三)plt基础

目录 一、前言 二、各类图 2.1、折线图 2.2、散点图 2.3、点线图 2.4、下三角线 2.5、点虚线 2.6、虚点线 2.7、绘制自己的学习曲线 三、多线 四、画布 五、直方图 一、前言 plt是深度学习的常用库之一&#xff0c;很多指标结果如AUC、F1、ROC等都是通过plt来实现。本篇文章主…

【每日数据结构与算法】

这里面有 10 个数据结构:数组、链表、栈、队列、散列表、二叉树、堆、跳表、图、Trie 树; 10 个算法:递归、排序、二分查找、搜索、哈希算法、贪心算法、分治算法、回溯算 法、动态规划、字符串匹配算法。 文章目录一、 基本算法思想1-1 回溯1-2 动态规划dp1-3二、 排序2-1 O(n…

【015 关键字】typedef和define的区别

一、两者区别 关键字typedefdefine&#xff08;宏&#xff09;作用不同定义&#xff08;标识符或关键字&#xff09;别名简单字符串替换执行时间不同编译过程一部分预处理过程完成作用域不同从定义到花括号“}”截至从定义到文件结尾截止 对指针操作不同 typedef int* INTPTR…

2023啦 最新无人直播小白教程!

最近看了不少up主说&#xff0c;无人直播这个东西可以做副业&#xff0c;自己手里也有一台五年的腾讯云服务器&#xff0c;一个月2t流量&#xff0c;应该是够的&#xff0c;可以玩玩。 先放出我的直播间地址看看效果&#xff1a; b站小红书&#xff08;深度sleep&#xff09;b站…

想要学会二叉树?树的概念与结构是必须要掌握的!快进来看看吧

目录 1.树的概念及结构 1.1什么是树&#xff1f; 1.2树的相关术语 1.3树的表示 2.二叉树的概念及结构 2.1二叉树的概念 2.2两种特殊的二叉树 2.3二叉树的性质 2.4二叉树的存储结构 2.4.1 顺序存储 2.4.2 链式存储 1.树的概念及结构 1.1 什么是树&#xff1f; 树是…

【JavaSE专栏6】Java 基本类型转换、包装类、自动装箱、自动拆箱

作者主页&#xff1a;Designer 小郑 作者简介&#xff1a;Java全栈软件工程师一枚&#xff0c;来自浙江宁波&#xff0c;负责开发管理公司OA项目&#xff0c;专注软件前后端开发&#xff08;Vue、SpringBoot和微信小程序&#xff09;、系统定制、远程技术指导。CSDN学院、蓝桥云…

SpringBoot05:员工管理系统

先不连接数据库&#xff0c;后面整合了mybatis再补充 步骤&#xff1a; 1、导入静态资源 下载地址&#xff1a;下载 - KuangStudy 2、在pojo包下写实体类 ①Department //部门表 Data AllArgsConstructor NoArgsConstructor public class Department {private Integer id;…

IPV4地址详解

文章目录IPV4地址分类编址划分子网无分类编制CIDR路由聚合应用规划&#xff08;子网划分的细节&#xff09;定长的子网掩码FLSM变长的子网掩码VLSMIPV4地址 IPV4地址就是给因特网&#xff08;Internet&#xff09;上的每一台主机&#xff08;或路由器&#xff09;的每一个接口…

恶意代码分析实战 2 动态分析基础技术

2.1 Lab3-1 使用动态分析基础技术来分析在Lab03-01.exe文件中发现的恶意代码。 问题 找出这个恶意代码的导入函数与字符串列表。 C:\Documents and Settings\Administrator>strings Lab03-01.exe ExitProcess kernel32.dll ws2_32 cksu advapi32 ntdll user32 StubPath SO…

39.Isaac教程--使用 Pose CNN 解码器进行 3D 物体姿态估计

使用 Pose CNN 解码器进行 3D 物体姿态估计 ISAAC教程合集地址: https://blog.csdn.net/kunhe0512/category_12163211.html 文章目录使用 Pose CNN 解码器进行 3D 物体姿态估计应用概述推理模块Pose CNN 解码器训练模块Pose CNN 解码器架构Pose CNN解码器训练从场景二进制文件生…

JAVA BIO与NIO、AIO的区别

1、 IO模型发展 在Java的软件设计开发中&#xff0c;通信架构是不可避免的&#xff0c;我们在进行不同系统或者不同进程之间的数据交互&#xff0c;或者在高并发下的通信场景下都需要用到网络通信相关的技术&#xff0c;对于一些经验丰富的程序员来说&#xff0c;Java早期的网…

通信原理简明教程 | 现代数字调制

文章目录1 多进制基带信号2 多进制数字调制2.1 多进制调制的基本原理2.2 MPSK调制3 MSK3.1 MSK信号的表示3.2 MSK的相位网格图3.3 MSK的产生和解调4 QAM4.1 QAM的基本原理4.2 QAM信号的产生和解调4.3 QAM信号的特性5 正交频分复用5.1 OFDM的基本思想5.2 OFDM的基本原理5.3 基于…

Python基础学习 -- 常用模块

一、time模块1、时间戳可以理解为是一个计算机世界的当前时间&#xff0c;很多加密验证什么的&#xff0c;都会用到import time ttime.time() print(int(t)) 运行结果&#xff1a; 16732534522、当前时间import time ttime.strftime("%Y-%m-%d %X") print(t) 运行结果…

vue项目搭建(offline方式)

项目搭建的前提 需要安装node.js&#xff0c;安装步骤可参考https://blog.csdn.net/qq_44628230/article/details/122634132 1.检查环境是否已准备好 2.全局安装vue-cli 3.进入到项目目录&#xff0c;创建一个基于 webpack 模板的新项目&#xff08;online&#xff09; 4.由…

JavaScript笔记+案例

前端开发 第四节JavaScript JavaScript&#xff1a;概要 概要&#xff1a; JavaScript&#xff0c;是一门编程语言。浏览器就是JavaScript语言的解释器。 DOM和BOM 相当于编程语言内置的模块。 例如&#xff1a;Python中的re、random、time、json模块等。jQuery 相当于是编程…

搭建代理服务器

搭建代理服务器搭建代理服务器场景ccproxy进行搭建代理服务器proxifier配置代理服务器总结搭建代理服务器 有这种情况&#xff0c;在家需要访问某个内网环境&#xff0c;但是内网的ip从外网是访问不到的&#xff0c;这种需要怎么处理呢&#xff1f; 答案是使用代理服务器。 …

索引失效原因

目录 1.最佳左前缀法则 2.不在索引列上做任何操作 3.存储引擎不能使用索引中范围条件右边的列 4.尽量使用覆盖索引 5.mysql 在使用不等于(! 或者<>)的时候无法使用索引会导致全表扫描 6..is null ,is not null 也无法使用索引 7.like以通配符开头(%abc...)mysql索…

tkinter布局详解

文章目录placepackgrid前情提要&#xff1a; Python UI 界面 tkinter初步Tkinter共有三种布局方案&#xff0c;分别是绝对位置布局 place&#xff0c; 相对位置布局 pack和网格布局 grid。place place是通过声明具体位置来进行布局的方法&#xff0c;这个具体位置既可以绝对坐…

【大数据管理】Java实现布谷鸟过滤器(CF)

实现布谷鸟过滤器&#xff0c;每当有一个小说被存储后将其加入布谷鸟过滤器&#xff0c;并能够使用布谷鸟过滤器查询上述小说是否已经被存储 一、解题思路 在介绍布谷鸟过滤器之前&#xff0c;首先需要了解布谷鸟哈希的结构。最简单的布谷鸟哈希结构是一维数组结构&#xff0…

JAVA基础知识05面向对象

目录 面向对象概述 为什么要学习面向对象&#xff1f; 1. 类和对象 1.1 类的介绍 1.2 类和对象的关系 组织代码 1.3 类的组成 1.4 创建对象和使用对象的格式 2. 对象内存图 2.1 单个对象内存图 2.2 两个对象内存图 3. 成员变量和局部变量 4. this 关键字 4.1 t…