简答题以下哪些算法适合用栈来实现? A、实现UNDO和REDO功能的算法 B、HTML标签匹配算法 C、求列表平均数的算法 D、1到N的累计求和算法简答题以下哪些关于栈的说法是正确的? A、栈的pop操作时间复杂度是O(n) B、栈的pop操作时间复杂度是O(1) C、栈的特性是先进先出(FIFO) D、栈的特性是后进先出(LIFO) E、括号匹配算法需要栈结构的参与 F、在Python中栈结构可以由list来实现简答题假设你执行了下列的栈操作:s = Stack()s.push(1)s.push(3)s.push(5)s.pop()s.push(7)现在栈内还有哪些元素? A、1, 5, 7 B、3, 5, 7 C、1, 3, 7 D、1, 3, 5简答题给定后缀表达式 3 6 + 5 2 - / 求值结果为? A、3 B、4 C、6 D、10简答题将以下中缀表达式: ( 5 - 3 ) * ( 2 + 4 ) 转换为后缀表达式,结果为? A、5 3 - 2 4 + * B、5 3 2 4 + * - C、5 3 2 * - 4 + D、5 3 2 * 4 + -简答题使用括号匹配算法判断以下表达式: ([()[]{]})结果是否匹配?匹配过程中栈内元素最多有多少个? A、否,3 B、是,3 C、是,4 D、否,4简答题以下未完成的函数可实现不同的功能 def func(lst1): s1, s2 = Stack(), Stack() for item in lst1: s1.push(item) lst2 = [] while not s1.isEmpty(): ### 在此进行代码填空 ### return lst2# 测试print(func([1, 3, 5, 7, 9]))在下列选项中,填空内容与分别对列表[1, 3, 5, 7, 9]调用结果相对应的选项有? A、lst2.append(s1.pop()) [9, 7, 5, 3, 1] B、lst2.append(s1.pop()) [1, 3, 5, 7, 9] C、 while not s1.isEmpty(): s2.push(s1.pop())lst2.append(s2.pop())while not s2.isEmpty(): s1.push(s2.pop())[1, 3, 5, 7, 9] D、while not s1.isEmpty(): s2.push(s1.pop())lst2.append(s2.pop())while not s2.isEmpty(): s1.push(s2.pop()) [9, 7, 5, 3, 1] E、lst2.append(s1.peek())死循环,无法运行 F、lst2.append(s1.peek())[9, 9, 9, 9, 9] G、for i in range(s1.pop()): s2.push(i)lst2.append(s2.size()) [9, 16, 21, 24, 25] H、for i in range(s1.pop()): s2.push(i)lst2.append(s2.size())[1, 4, 9, 16, 25]简答题判断以下函数的功能 def func(str1): s = Stack() for char in str1: s.push(char) str2 = '' while not s.isEmpty(): str2 += s.pop() return str2 A、将给定的字符串反转输出 B、判断给定字符串长度 C、将给定字符串复制并输出 D、包含错误,无法运行